user1147862
user1147862

Reputation: 4226

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.

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:

What am I missing here?

Upvotes: 3

Views: 1532

Answers (1)

user1147862
user1147862

Reputation: 4226

In the end, I found that I had to change the system environment variable MSBuildSdksPath to make it point at the new .net5 Sdk directory.

In my case, I repointed it at: C:\Program Files\dotnet\sdk\5.0.203\Sdks

Upvotes: 1

Related Questions