Universal application with visual studio online

巧了我就是萌 提交于 2019-12-11 11:51:22

问题


I'm currently setting up project in Visual Studio Online (VSO) and having troubles with setting up automated build. My solution contains projects targeted as Universal Windows VSO uses msbuild to run my project.

During build I see strange error messages like:

    Error CS0518: Predefined type 'System.Void' is not defined or imported
    Error CS0518: Predefined type 'System.Object' is not defined or imported
    Error CS0246: The type or namespace name 'Uri' could not be found (are you missing a using directive or an assembly reference?)

msbuild is invoked with following parameters:

    C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild.exe "C:\a\b0d9e3fd\test\src\Shipping.sln" /nologo /m /nr:false /fl /flp:"logfile=C:\a\b0d9e3fd\test\src\Shipping.sln.log" /dl:CentralLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:Platform=Win32 /p:TargetVersion=”Windows10” /p:TargetPlatformVersion=”10.0.10010.0” /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="14.0"

What's wrong with this? Are there any other additional parameters required to build universal windows app with msbuild?


回答1:


Are you targeting the Windows 10 SDK? If so note that it is not installed on the TFS hosted build servers. Consequently you will not be able to build apps that use the Windows 10 SDK. You can see the complete list of installed software here.




回答2:


Just found the solution.

If build UWP app, from VS it resolves NuGet dependencies automatically. By default VS 10 projects uses NuGet of 3rd version, which was not installed on our build machine. That's why we had such issue. The problem was fixed with installing NuGet 3 onto build agent and configure script which resolves NuGet packages before build.




回答3:


If you can't customize the software of your build agent (aka: the free Hosted Agent) another work-around is to just check in your project.lock.json file.

This is because NuGet v2.8.7 can read both project.json and project.lock.json files but it cannot generate a project.lock.json file from a project.json file.

And, if at such a time Microsoft updates NuGet for their default build agents, you can just remove it from source-control and let it generated automatically as part of Nuget -restore. Until then, just check it in.



来源:https://stackoverflow.com/questions/32071290/universal-application-with-visual-studio-online

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!