【问题标题】:VSTS Online Building Setup Projects?VSTS 在线构建设置项目?
【发布时间】:2018-03-16 04:50:40
【问题描述】:

我有一个带有安装项目的 .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 吗?
  • 是的,我已经在本地机器上成功运行了"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" SolutionName.sln /Build "release|any cpu" /Project Setup\Setup.vdproj
  • 当您将其作为 VSTS 版本定义的一部分时会发生什么?你得到什么错误? “不能完全让它工作”不是一个体面的错误描述。
  • 对不起,我的描述有问题。我只是将命令更改为C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com,这影响了结果(仍然失败,但不同)。现在我得到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 ========== 不确定如何访问该升级日志,因为它位于托管代理上。
  • 终于可以在托管构建代理上实现了:github.com/actions/virtual-environments/issues/…

标签: c# console-application azure-devops setup-project


【解决方案1】:

要通过 VS 安装程序项目构建 .msi 文件,您可以在市场中使用 Build VS Installer 任务

您可以在Task-mode选项中指定构建.sln.vdproj以生成.msi文件。

【讨论】:

  • 谢谢!我刚试过这个,不能让它工作。任务成功完成,但似乎从未真正生成 MSI,并且它没有出现在工件掉落中。这是我的任务日志:Done running DevEnv process. Success = True. The single MSI should be located here: d:\a\1\s\Setup\release\. ##[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.
  • 您能在此处添加带有任务配置的屏幕截图吗?
  • 已将其添加到问题中
  • 它似乎是由托管VS2017代理构建的,并选择VS版本为VS 2015。请使用私人代理排队构建。如需设置私人代理,您可以参考docs.microsoft.com/en-us/vsts/build-release/actions/agents/…
  • 谁能指导我如何将任务(如此处所述的 Build VS Installer)添加到我的构建管道中?我的意思是没有像其他任务那样的添加选项。
【解决方案2】:

您必须 configure your own build agent 运行构建,因为 Visual Studio 安装程序项目扩展未安装在 Hosted & Hosted 2017 代理上。

确保 VS Installer Projects 扩展已安装在您自己的构建代理上,然后您可以使用带有“devenv”的命令行任务或使用“构建 VS 安装程序”任务来构建安装项目。

如果您收到“8000000A”错误,如下所示: 请按照此处的说明配置您的构建代理:Solution: An error occurred while validating. HRESULT = '8000000A'

那么您应该能够成功构建安装项目:

【讨论】:

  • 要在 VS17(和构建机器)中设置相同的设置,请参考这个 SO 答案:stackoverflow.com/a/41788791/7518695
  • 当您说“VS Installer Projects 扩展安装在您自己的构建代理上”时,您的意思是,1. 从构建服务器上的 Visual Studio 中的扩展安装它。或者 2. 从市场上下载并安装它。如果是第二个选项,请告诉我如何安装,我已经下载并解压了 zip 文件。
猜你喜欢
  • 2018-10-05
  • 2018-03-07
  • 1970-01-01
  • 1970-01-01
  • 2019-02-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-11
相关资源
最近更新 更多