【发布时间】:2018-11-29 18:11:04
【问题描述】:
过去几天我一直在努力弄清楚如何设置 CI/CD 流程来构建简单的 WPF 解决方案并使用 Azure DevOps Pipelines 创建 MSI 设置文件(“工件”)。我曾尝试使用Build VS Installer 来完成此操作。我的主要问题是我不知道自己做错了什么或遗漏了哪些步骤,而且我在任何地方都找不到明确的说明。
这是我尝试过的:
-
使用 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).
- 按照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).
我还尝试了从市场而不是 DutchWorkz 的 DevEnv Build,但仍然无法获得 .msi 文件。有人可以告诉我一些关于如何实现这个简单目标的明确步骤吗?
【问题讨论】:
-
如果我没记错的话,托管代理没有为此安装 VS 扩展。这就是为什么必须为此设置私人代理的原因。另外,您不能从命令行触发 MSI 的生成吗?您是否尝试过从 powershell 手动启动该命令?
-
@RobBos 谢谢你的建议。这也是我读到的关于托管代理的内容,这就是为什么我尝试设置自己的代理并确保在该机器上安装了 VS 扩展。仍然无法让它工作。如果我知道该怎么做,那听起来像是一个伟大的灵魂。如果你能告诉我我会很乐意接受这个答案。我的最终目标是输出 .msi 文件,而不管方法如何(越简单越好):)
-
要执行命令行任务,添加“Batch Script”任务,“value”值应该是“C:\Windows\System32\cmd.exe”,arguments”值应该是: “msi 编译命令到这里!”
-
@Atebios 这听起来可能可行。我试了一下,但没有用。错误 MSB4025:无法加载项目文件。根级别的数据无效。不确定我是否使用了正确的论点。你对此有什么指示吗?谢谢。
-
有什么方法可以使用 "DutchWorkz" 在发布模式下构建 MSI 吗?
标签: c# azure-devops azure-pipelines setup-project