如何使用Azure DevOps管道正确构建MSI安装项目?

时间:2018-11-29 18:11:05

标签: c# azure-devops azure-pipelines setup-project

在过去的几天里,我一直在努力寻找如何设置CI / CD流程,以便仅使用Azure DevOps Pipelines构建一个简单的WPF解决方案并创建MSI安装文件(“工件”)的方法。我尝试使用Build VS Installer完成此操作。我的主要问题是我不知道我到底在做什么错或我缺少什么步骤,而且我在任何地方都找不到明确的说明。

这是我尝试过的:

  1. 使用Hosted 2017代理程序池和基本的.NET桌面模板。问题:

    • 从VS Installer项目中创建.msi文件作为最后一个任务或在发布工件之前)。

2018-11-28T22:57:56.3186071Z DEBUG: Aggregated: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com 2018-11-28T22:57:56.3211382Z Now running (C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com) with Arguments ("D:\a\1\s" /Build "release|any cpu" /Out "D:\a\1\b\BuildInstaller_Log_20181128225756.txt") 2018-11-28T22:58:54.0015320Z Done running DevEnv process. Success = True. 2018-11-28T22:58:54.1169279Z ##[warning]No .MSI files were found, please check your build-configuration. If this is expected, you might consider to use the default Visual Studio Build task instead of this custom Installer task. 2018-11-28T22:58:54.1434410Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).

enter image description here

  1. 按照in the documentation所述创建自己的构建代理。我在服务器上安装了带有VS Installer Projects extension的Visual Studio Community 2017。我遵循了this相关答案中的步骤。结果:

2018-11-29T17:46:03.9813075Z DEBUG: Aggregated: System.Object[]\devenv.com 2018-11-29T17:46:04.4346060Z ##[error]Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard character pattern is not valid: System.Object[] 2018-11-29T17:46:04.4716416Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).

enter image description here

我还从市场尝试了DevEnv Build,而不是DutchWorkz,但仍然无法获得.msi文件。有人可以告诉我一些明确的步骤来实现这个简单的目标吗?

2 个答案:

答案 0 :(得分:2)

我能够弄清楚为什么我在下面得到了特定的错误消息,并希望分享一下,以防将来对任何人有帮助。

调试:

  

总计:System.Object[]\devenv.com   [错误]无法检索该cmdlet的动态参数。指定的通配符模式无效:System.Object[]

问题是我的私人生成服务器上安装了两个版本的Visual Studio 2017(专业版和企业版)。一旦我删除了其中一个,一切都很好。不知道是否有办法同时安装它们,但是我不需要两者。

答案 1 :(得分:0)

Microsoft Visual Studio 安装程序项目扩展存在于 windows-latest 运行程序中。查找更多here

简而言之,使用带有 windows-latest vmimage 的代理并通过 devenv.exe 而不是 MSBuild 进行构建。