Is it possible to use a TFS 2018 Server (Version 16.131.27701.1) to build a C# program with Visual Studio 2019? If so, how?
I have a build agent (with Azure Pipelines Agent v2.184.0) that has Visual Studio 2019 installed. TFS says it has the following capabilites:
In my build pipeline I tried both the Visual Studio Build task and the MSBuild task. However with both tasks, I can only select a Visual Studio version up to 2017:
When using "Latest", it automatically falls back to using 4.0:
Project file contains ToolsVersion="16.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0".
I even tried setting the path to MSBuild 16.0 manually:
Then I get a different error:
C:\Program Files\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1004: Assets file 'C:\Users[...]\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
However the NuGet Restore task is right before the MSBuild task and it completed successfully!