简体   繁体   English

如何使用Visual Studio 2017或Mage为Live和Test(QA)版本发布WPF双重部署

[英]How to publish WPF dual deployments for Live and Test (QA) versions using Visual Studio 2017 or Mage

I'm hoping there are some .Net WPF devs out there who can show off their deployment guru knowledge and answer this question. 我希望有一些.Net WPF开发人员可以展示他们的部署专家知识并回答这个问题。 I want to deploy two versions of a WPF desktop application; 我想部署两个版本的WPF桌面应用程序; one live and one test (QA). 一个实时和一个测试(QA)。

We're coming to the end of the initial development of a WPF desktop application that will run within our internal network only. 我们即将完成WPF桌面应用程序的初始开发,该应用程序仅在我们的内部网络中运行。 The deployment is to a file share using ClickOnce configured simply via Visual Studio 2017. We have users testing who benefit from the ClickOnce update when we deploy updates (typically bug fixes). 使用ClickOnce简单地通过Visual Studio 2017配置文件共享。我们让用户在部署更新时测试谁从ClickOnce更新中受益(通常是错误修复)。 When we go live we will set our internal properties to point at a live database instance. 当我们上线时,我们将内部属性设置为指向实时数据库实例。

After we have gone live we will start the next phase of development. 我们上线后,我们将开始下一阶段的开发。 Then we will need a 'Test' version alongside the now 'Live' version on their desktop. 然后我们将需要一个“测试”版本以及他们桌面上现在的“实时”版本。 We don't know how to do that. 我们不知道该怎么做。 Looking at the Microsoft docs it just doesn't seem this use-case is explained. 看一下微软的文档,它似乎并没有解释这个用例。 It might be but it's just not clear. 它可能是,但它只是不清楚。 A tutorial / walkthrough would be brilliant! 教程/演练将是辉煌的!

I found one answer on StackOverflow however it is a work-around that requires some overhead. 在StackOverflow上找到了一个答案,但是这是一个需要一些开销的解决方法。 There is a comment there about using Mage but nothing in depth that makes clear what to do and as stated the MSDN documentation is quite broad and with few examples. 有一个关于使用Mage的评论,但没有任何深入的内容表明该做什么,并且如所述MSDN文档相当广泛且几乎没有例子。

Based on a related vlog I have documented a solution: 基于相关的vlog,我记录了一个解决方案:

Steps 脚步

  • Create a source control (github) branch for the 'Test' version, with 'Live' on master (any branching arrangement should work as long as there are two) 为'Test'版本创建一个源代码控制(github)分支,在master上使用'Live'(任何分支安排应该有效,只要有两个)
    • git branch Test
    • git push -u origin Test (this could be done once the local changes below are made) git push -u origin Test (这可以在下面的本地更改完成后完成)
  • In Visual Studio 2017 (VS) under 'Publish... Application' add "Test" postfix to the 'Assembly name' 在“发布...应用程序”下的Visual Studio 2017(VS)中,将“测试”后缀添加到“程序集名称”中
  • In VS under 'Publish... Publish' add "Test" postfix to the 'Publishing Folder Location' and the 'Installation Folder URL' 在“发布...发布”下的VS中,将“测试”后缀添加到“发布文件夹位置”和“安装文件夹URL”
  • In VS under 'Publish... Publish... Options...' add "Test" postfix to the 'Product name' 在VS中的“发布...发布...选项...”下,将“测试”后缀添加到“产品名称”中

Custom Steps 自定义步骤

  • Add "Test" postfix to log file name (we use log4net configured in 'App.config') 将“Test”后缀添加到日志文件名中(我们使用在“App.config”中配置的log4net)
    <file value="${LOCALAPPDATA}\\\\Our_Company\\\\log-Test.txt" />
  • Any other files or resources used by the application (we don't have any) 应用程序使用的任何其他文件或资源(我们没有)
  • We have an application icon in 'Resources' that has a different colour for the 'Test' version than the 'Live' 我们在“资源”中有一个应用程序图标,其“测试”版本的颜色与“实时”不同

After these steps go ahead and 'Publish' and there are two desktop versions. 完成这些步骤并继续“发布”后,有两个桌面版本。 Then we share the links, to the setup.exe, by email with our users. 然后我们通过电子邮件与我们的用户共享链接到setup.exe。

Finally, once the test (QA) phase is complete merge the 'Test' branch to 'master' (or whichever branch 'Live' is on) and reverse the renaming steps above (ie remove all the "Test" postfixes). 最后,一旦测试(QA)阶段完成,将'Test'分支合并为'master'(或者'live'所在的分支)并反转上面的重命名步骤(即删除所有“Test”后缀)。 And reverse any custom steps too. 并反转任何自定义步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM