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

iCo*_*min 8 c# setup-project azure-devops azure-pipelines

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

这是我尝试过的:

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

    • 从 VS 安装程序项目创建 .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).

在此处输入图片说明

  1. 按照文档中的说明创建我自己的构建代理。我在该服务器上安装了Visual Studio Community 2017 和VS Installer Projects 扩展。我按照这个相关答案中的步骤操作。结果:

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

在此处输入图片说明

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

小智 4

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

调试:

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

问题是我的私人构建服务器上安装了两个版本的 Visual Studio 2017(专业版和企业版)。一旦我删除了其中一个,一切都很好。不确定是否有办法让它在安装两者的情况下工作,但我不需要两者都安装。