如何同时部署两个 ClickOnce 版本? [英] How do I deploy two ClickOnce versions simultaneously?

查看:20
本文介绍了如何同时部署两个 ClickOnce 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够为我的应用程序提供一个测试 ClickOnce 服务器,用户可以在其中并行运行生产版本和测试版本.这可能吗?

我首先尝试在 AssemblyInfo.cs 中使用以下内容,并更改 ClickOnce 部署中的名称,尽管这一切都是用测试版本覆盖用户的生产版本.同样,当他们回到生产服务器时也是如此.

#if DEBUG[装配:AssemblyTitle("产品名称-测试")]#别的[程序集:AssemblyTitle("产品名称")]#万一

我想我还应该澄清一下,这两个部署位置彼此不同并且位于不同的服务器上.

更新

我还尝试根据调试模式为清单设置 GUID,但它再次不起作用(下面使用了虚拟 GUID).

#if DEBUG[组装:Guid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]#别的[组装:Guid("BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB")]#万一

两者如何区分?似乎安装程序将它们视为两个单独的程序,因为我得到了每个程序的安装确认.虽然,当我安装第二个时,添加/删除程序"只看到后者,虽然前者仍在磁盘上,但当我稍后重新安装时,它只是简单地运行,但随后添加/删除程序切换回到以前的名字.

解决方案

这听起来可能有点蹩脚,但最简单的方法是在您的解决方案中包含两个 EXE 项目.其中每个的 Main 方法只会调用原始 EXE 项目中的 Main 方法(您刚刚将其切换为 DLL 文件).

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

您的另一种选择(似乎最有意义的选择)是使用 MageUI.exe 手动构建 ClickOnce 文件,这将允许您在每次运行该工具时选择不同的配置文件和发布位置.还有一个命令行版本 (Mage.exe),因此理论上您可以自动执行此操作.

然而,我们发现有两个runner"项目的解决方案要简单得多.我建议您先尝试一下.

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?

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.

UPDATE

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.

解决方案

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).

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.

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.

这篇关于如何同时部署两个 ClickOnce 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆