1
votes

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?

3

3 Answers

1
votes

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.

0
votes

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.

0
votes

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.