VSTS在线构建设置项目?

7
我有一个带有安装程序的.NET控制台应用程序,我正在尝试将其移植到VSTS Online(visualstudio.com)以利用源代码控制,并添加自动化构建/部署。
我已经成功上传了代码并构建得很好,但是在生成MSI方面遇到了困难。我尝试在解决方案构建后引入命令行任务来运行devenv.com,但我无法完全使其正常工作。有关如何让安装程序项目生成其MSI的任何想法吗?
谢谢!
编辑:
这是我尝试过的命令行任务:
Tool: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv
Arguments: SolutionName.sln /Build $(BuildConfiguration) /Project Setup\Setup.vdproj

编辑 2:

新的命令行:

Tool: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com
Arguments: MySolution.sln /Build $(BuildConfiguration) /Project Setup\Setup.vdproj

日志:

2017-10-04T17:58:48.7033117Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com" MySolution.sln /Build release /Project Setup\Setup.vdproj
2017-10-04T17:59:12.1156461Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1196471Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1196471Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1196471Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1206475Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1206475Z microsoft.visualstudio.telemetry.dll
2017-10-04T17:59:12.1206475Z microsoft.visualstudio.extensionmanager.implementation.dll
2017-10-04T17:59:46.2231714Z 
2017-10-04T17:59:46.2231714Z Microsoft Visual Studio 2017 Version 15.0.26730.3.
2017-10-04T17:59:46.2231714Z Copyright (C) Microsoft Corp. All rights reserved.
2017-10-04T17:59:46.2231714Z 
2017-10-04T17:59:46.2231714Z Some errors occurred during migration. For more information, see the migration report:
2017-10-04T17:59:46.2231714Z d:\a\1\s\UpgradeLog.htm
2017-10-04T17:59:46.4634939Z ========== Build: 0 succeeded or up-to-date, 0 failed, 0 skipped ==========
2017-10-04T17:59:48.5239469Z ##[section]Finishing: Run C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com

编辑3:

根据@Marina - MSFT的建议,我尝试了Build VS Installer,但它对我并没有完全奏效。该任务成功完成,但似乎MSI从未实际生成,因为在构建成果中没有任何东西出现。以下是任务日志:

2017-10-04T20:38:12.1314337Z ##[section]Starting: Create .msi file(s) from VS Installer project(s).
2017-10-04T20:38:12.1314337Z ==============================================================================
2017-10-04T20:38:12.1314337Z Task : DutchWorkz - Build VS Installer(s)
2017-10-04T20:38:12.1314337Z Description : Build .msi file(s) from VS Installer project(s).
2017-10-04T20:38:12.1314337Z Version : 1.2.4
2017-10-04T20:38:12.1314337Z Author : DutchWorkz B.V.
2017-10-04T20:38:12.1324342Z Help : <b>BuildVsInstaller v1.2.4</b>, DutchWorkz B.V. (Robin Paardekam)<br/><br/>Visual Studio Installer projects are not supported by MSBUILD, so a regular build will not generate your installer files (.msi). Use this build-task to build the .msi file(s) for your project by running devenv on the buildagent directly. <br/><br/><b>Dependencies:</b><br/>Dep1: when using VisualStudio 2017, this task will only function properly if you installed it in the default C:\Program Files (x86)\ location.
2017-10-04T20:38:12.1324342Z ==============================================================================
2017-10-04T20:38:15.3883721Z DEBUG: Aggregated: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\IDE\devenv.com
2017-10-04T20:38:15.4043950Z Now running (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\IDE\devenv.com) with Arguments ("d:\a\1\s\MySolution.sln" /Build "release|any cpu" /Project "d:\a\1\s\Setup\Setup.vdproj" /Out "d:\a\1\b\BuildInstaller_Log_20171004203815.txt")
2017-10-04T20:39:39.8930682Z Done running DevEnv process. Success = True.
2017-10-04T20:39:39.8950669Z The single MSI should be located here: d:\a\1\s\Setup\release\
2017-10-04T20:39:40.0450669Z ##[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.
2017-10-04T20:39:40.0560673Z ##[section]Finishing: Create .msi file(s) from VS Installer project(s).

任务配置

任务配置


如果您在自己的计算机上运行相同的命令行参数,最终会得到一个MSI文件吗? - mason
是的,我已经在本地机器上成功运行了 "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" SolutionName.sln /Build "release|any cpu" /Project Setup\Setup.vdproj - Hershizer33
我对VSTS在线还比较新,是否有设置非托管代理的指南? - Hershizer33
1
终于可以在托管的构建代理上实现了:https://github.com/actions/virtual-environments/issues/1382#issuecomment-699577543 - softworkz
公共代理的解决方案:https://dev59.com/EbHma4cB1Zd3GeqPQcSc#68646694 - andrew.fox
显示剩余4条评论
2个回答

6
要通过VS安装程序项目构建.msi文件,您可以在市场中使用Build VS Installer任务
您可以在任务模式选项中指定构建.sln或.vdproj以生成.msi文件。
请参考以下截图: enter image description here

1
谢谢!我刚试了一下,但好像无法正常工作。任务成功完成,但似乎没有生成MSI文件,并且在构件发布中也找不到它。以下是来自任务的日志:DevEnv进程运行完成。Success = True。单个MSI应该位于此处:d:\a\1\s\Setup\release\。##[warning]未找到.MSI文件,请检查您的构建配置。如果这是预期的结果,您可以考虑使用默认的Visual Studio Build任务,而不是此自定义Installer任务。 - Hershizer33
你能在这里添加任务配置的截图吗? - Marina Liu
已将其添加到问题中。 - Hershizer33
似乎是由托管的VS2017代理构建的,并选择了VS 2015作为版本。请使用私有代理排队构建。要设置私有代理,请参考https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows。 - Marina Liu
有没有人可以指导我如何将一个任务(如在此处所述的Build VS Installer)添加到我的构建管道中?我的意思是,没有像其他任务那样的添加选项。 - Raq

4

由于托管和托管2017代理程序没有安装Visual Studio Installer Projects扩展,因此您必须配置自己的构建代理以运行构建。

确保在自己的构建代理上安装了VS Installer Projects扩展,然后可以使用“devenv”命令行任务或使用“Build VS Installer”任务构建设置项目。

如果您遇到像以下这样的“8000000A”错误: enter image description here 请按照此处的说明配置您的构建代理:解决方案:验证时出错。 HRESULT = '8000000A'

那么你应该能够成功构建安装程序项目: 在此输入图片描述


2
要在VS17(以及构建机器)中设置相同的设置,请参考此SO答案:https://dev59.com/tWoy5IYBdhLWcg3wScLb#41788791 - GrayCat
当你说“VS Installer Projects扩展已安装在你自己的构建代理上”时,你是指:1. 从Visual Studio扩展上安装它并出现在构建服务器上。或者2. 从市场下载并安装它。如果是第二个选项,请告诉我如何安装,我已经下载并解压缩了zip文件。 - Raq

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接