2017-03-02 186 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

相关问题