Popular blog tags

Does global.json specify sdk in Asp .Net core 5.x?

Published

This article explains the policies used by the .NET Core tools, SDK, and runtime for selecting versions.

 

Error Message:

cd /src/Presentation/Nop.WebSeoForMobile
root@iZuf:/src/Presentation/Nop.WebSeoForMobile# dotnet run
/usr/share/dotnet/sdk/3.1.301/Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/src/Presentation/Nop.WebSeoForMobile/Nop.WebSeoForMobile.csproj]

The build failed. Fix the build errors and run again.

 

step 1:Check everything installed correctly

To make sure it works after you’ve set it up, just run:

# dotnet --info

output

.NET Core SDK (reflecting any global.json):
 Version:   3.1.301
 Commit:    7feb845744

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.301/

Host (useful for support):
  Version: 5.0.0-rc.1.20451.14
  Commit:  38017c3935

.NET SDKs installed:
  3.0.100 [/usr/share/dotnet/sdk]
  3.1.301 [/usr/share/dotnet/sdk]
  5.0.100-rc.1.20452.10 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

step 2:Select one of the .NET Core versions from .NET SDKs installed 

version selected

.NET SDKs installed:
  3.0.100 [/usr/share/dotnet/sdk]
  3.1.301 [/usr/share/dotnet/sdk]
  5.0.100-rc.1.20452.10 [/usr/share/dotnet/sdk]

step 3:placing this global.json into solution folder

global.json

old

{
  "sdk": {
    "version": "3.1.301"
  }
}

new

{
  "sdk": {
    "version": "5.0.100-rc.1.20452.10"
  }
}