在构建服务器上构建 UWP apps/library

Build UWP apps/library on build server

我尝试使用 MSBuild 2015 工具在构建服务器上构建 UWP 库。我已经安装了 Windows 10 SDK 和其他需要的工具,但我还没有 Visual Studio 2015。当我尝试使用此命令构建时:

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 library/apps?

您需要确保构建机器在 运行 msbuild 命令之前在解决方案文件夹上运行 <path_to_nuget.exe>\nuget.exe restore

这将下载您的解决方案所需的所有 nuget 包!

Nuget.exe 不是 Visual Studio 或 Windows SDK 的一部分,因此您可能必须先将其下载到服务器(或确保您有一个构建脚本可以做到这一点为你)

pack 和 restore 现在是 msbuild 目标 (2017)。 尝试 msbuild /t:restore 然后 msbuild。 运行 这来自管理员 cmd 提示