2017-03-02 113 views
2

我嘗試使用MSBuild 2015工具在構建服務器上構建UWP庫。我已經安裝了Windows 10 SDK和其它需要的工具,但我沒有的Visual Studio 2015年當我嘗試建立與此命令:在構建服務器上構建UWP應用程序/庫

msbuild mySolution.sln /t:Rebuild/p:Configuration=Release;Platform=x86;AppxBundlePlatforms=x86;AppxBundle=Always 

或嘗試這方面的例子: compilebuild-the-uwp-project-from-command-line,仍然沒有工作,我得到了錯誤:

... 
error CS0518: Predefined type 'System.Boolean' is not defined or imported 
error CS0518: Predefined type 'System.Void' is not defined or imported 
error CS0518: Predefined type 'System.Object' is not defined or imported 
error CS0518: Predefined type 'System.Int32' is not defined or imported 
error CS0518: Predefined type 'System.Void' is not defined or imported 
error CS0518: Predefined type 'System.Boolean' is not defined or imported 
error CS0518: Predefined type 'System.Boolean' is not defined or imported 
... 

當我安裝VS時,一切正常,但我不想安裝VS構建服務器上。

是否可以在沒有Visual Studio的情況下構建UWP庫/應用程序?

+0

我認爲你首先需要做一次nuget恢復。認爲.net核心軟件包丟失 –

+0

,這也是很好的文檔https://docs.microsoft.com/en-us/windows/uwp/packaging/auto-build-package-uwp-apps –

+0

我試過用nuget restore ,但它沒有奏效。 – paulExe

回答

0

包和恢復,現在msbuild目標(2017)。 嘗試msbuild/t:恢復,然後msbuild。 從管理員cmd提示運行此操作

+0

我希望msbuild/t:restore(和build)應該在沒有高程的情況下工作 – rido

+0

當我嘗試這個解決方案時,我得到錯誤MSB4057:目標「恢復」在項目中不存在。 '我需要添加一些恢復目標到項目嗎? – paulExe

+0

當我說(2017)時,我的意思是Visual Studio 2017. –

0

在運行msbuild命令之前,您需要確保生成機器在解決方案文件夾上運行<path_to_nuget.exe>\nuget.exe restore

這將下載您的解決方案所需的所有nuget軟件包!

Nuget.exe不是Visual Studio或Windows SDK中的一部分,所以你可能需要將其下載到服務器的第一個(或確保你有一個構建腳本,它是你)

+0

我嘗試使用nuget restore,但它不起作用。 – paulExe

相關問題