我如何同时部署两个的ClickOnce版本?两个、版本、ClickOnce

2023-09-02 11:56:20 作者:久伴你

我想有一个测试的ClickOnce服务器,我的应用程序,用户可以同时运行生产版本和并行测试版本的功能。这可能吗?

I would like the ability to have a test ClickOnce server for my applications where users can run both the production version and the test version in parallel. Is this possible?

我第一次尝试使用下面的的AssemblyInfo.cs ,并更改名称,在ClickOnce部署尽管这一切都实现了覆盖用户的量产版与测试版。同样,它也做了同样的时候,他们又回到了生产服务器。

I first tried using the following in AssemblyInfo.cs and also changing the name in the ClickOnce deployment though all this achieved was overwriting the users' production version with the test version. Likewise, it did the same when they went back to the production server.

#if DEBUG
[assembly: AssemblyTitle("Product Name - Test")]
#else
[assembly: AssemblyTitle("Product Name")]
#endif

我想我也应该澄清的是,这两种部署地点是距离彼此不同的服务器上。

I thought I should also clarify that the two deployment locations are different from one another and on different servers.

更新

我也试着设置的GUID根据调试模式下的表现,但同样它不工作(虚拟GUID的下面使用)。

I've also tried setting the GUID for the manifest depending on the debug mode, but again it does not work (dummy GUID's used below).

#if DEBUG
[assembly: Guid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]
#else
[assembly: Guid("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB")]
#endif

如何是两个杰出的?看来,安装程序会将其视为两个独立的程序,因为我得到安装的每一个确认。不过,当我安装第二个,添加/删除程序只看到了后者,但前者仍然在磁盘上,因为当我去以后重新安装它,它只是简单地运行,但随后的添加/删除程序开关返回到以前的名称。

How are the two distinguished? It seems that the installer sees them as two separate programs as I get a confirmation of installation for each. Though, when I install the second one, "Add/Remove Programs" only sees the latter, though the former is still on disk, as when I go to reinstall it later, it just simply runs, but then the add/remove programs switches back to the former name.

推荐答案

这听起来样的跛脚,但要做到这一点最简单的方法就是在你的解决方法二EXE项目。所有这些的方法只需要调用方法,你原来的EXE项目(这你得刚切换到作为一个DLL文件)。

It might sound kind of lame, but the easiest way to do this is to have two EXE projects in your solution. The Main method of each of these will just call the Main method in your original EXE project (which you'll have just switched over to being a DLL file).

这意味着每个EXE项目都可以有自己的ClickOnce发布设置,以及它自己的的app.config 文件。这意味着你必须为生产和测试版本不同的连接字符串。

This means that each EXE project can have its own ClickOnce publishing settings, as well as its own app.config file. This means you have different connection strings for the production and the test version.

您的其他选项(一说似乎使最有意义)是使用的 MageUI.exe 以手工打造的ClickOnce文件,这将让你选择不同的配置文件,并运行该工具每次发布位置。还有一个命令行版本(Mage.exe),所以你在理论上可以自动执行此。

Your other option (the one that might seem to make the most sense) is to use MageUI.exe to manually build the ClickOnce files, which would let you choose a different configuration file and publish location each time you ran the tool. There's also a command line version (Mage.exe) so you could in theory automate this.

不过,我们发现了两个亚军项目的解决方案是远远简单。我建议你​​尝试的第一次。

However, we found that the solution with two "runner" projects was far far simpler. I'd recommend you try that first.