2017-10-04 121 views
0

我有一個安裝項目的.NET控制檯應用程序,我嘗試移植到VSTS Online(visualstudio.com)以使用源代碼管理以及添加自動構建/部署。VSTS在線建築安裝項目?

我已經把代碼上傳得很好,它建立很好,但我正在努力讓它產生一個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). 

任務配置

Task Config

+0

如果您在自己的機器上運行這些相同的命令行參數,你最終得到的MSI? – mason

+0

是的,我已經運行了C:Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ devenv.com「SolutionName.sln/Build」release | any cpu「/ Project Setup \ Setup.vdproj'在本地機器上取得成功。 – Hershizer33

+0

當您將它作爲VSTS發行版定義的一部分時,會發生什麼?你會得到什麼錯誤? 「無法完成這項工作」不是一個體面的錯誤描述。 – mason

回答

1

你必須configure your own build agent,因爲Visual Studio安裝項目擴展未在託管& 2017年託管代理安裝到運行構建。

確保VS Installer Projects擴展安裝在您自己的構建代理上,然後可以使用帶有「devenv」命令行任務或使用「Build VS Installer」任務構建安裝項目。

,如果你得到了「8000000A」錯誤,如下列: enter image description here 請按照指示在這裏配置構建代理:Solution: An error occurred while validating. HRESULT = '8000000A'

那麼你應該能夠建立成功安裝項目: enter image description here

2

打造由VS安裝項目.msi文件,你可以使用Build VS Installer任務的市場。

您可以指定生成.sln.vdproj以在任務模式選項中生成.msi文件。

enter image description here

+0

謝謝!我只是嘗試過,並不能完全實現。該任務成功完成,但似乎MSI從未實際生成,並且不出現在工件下拉菜單中。這是我的任務日誌:'完成運行DevEnv進程。成功=真。單個MSI應位於此處:d:\ a \ 1 \ s \ Setup \ release \。 ## [警告]找不到.MSI文件,請檢查您的構建配置。如果這是預期的,則可以考慮使用默認的Visual Studio Build任務而不是此定製安裝程序任務。' – Hershizer33

+0

您可以在此處添加帶有任務配置的屏幕快照嗎? –

+0

將其添加到問題 – Hershizer33