Building net5.0 solution on TeamCity agent results in “reference assemblies not found” error

I have recently upgraded our .Net Core 2.2 application to .Net 5.0. I'm now trying to upgrade our TeamCity build agent, so it can build this solution.

  • Installed the .Net 5.0 SDK on the build agent, and restarted the machine.
  • Installed the latest Community edition of Visual Studio on the build agent as well.

When I try to run a build on the agent using "dotnet msbuild", it shows this error message:

[Building CodeEngineQueryBuilder4] C:\Program Files\dotnet\sdk\5.0.202\Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v5.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.

More info:

  • RDPed onto the build agent and run "dotnet --info" on the command line, which gave me ".Net SDK Version 5.0.203"
  • I did find directory "C:\Program Files\dotnet\sdk\5.0.203" on the build agent, so it seems .Net 5.0 is installed.
  • The build agent runs Windows 8.1. The TeamCity installation is on the latest version.

What am I missing here?

Please sign in to leave a comment.