'How to install specified framework in Teamcity server as a build step

I have dotnet project built using dotnetcore v2.0 which was working fine in Teamcity pipeline.

I have updated the project to use dotnetcore v3.0 and re-run the Teamcity build.

now I am getting the error

It was not possible to find any compatible framework version

The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
 - The following frameworks were found:
     1.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
     2.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
     2.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
     2.2.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
     5.0.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

How to install the dotnetcore v3.0 in the build step.



Solution 1:[1]

I am not sure TeamCity will do it for you. You will need to go install it on the build agent.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 N.Gamble