Troubleshooting .NET
.NET and .NET Core
".NET" and ".NET Core" are effectively the same thing. .NET 5
is
the upgrade to .NET Core 3.1
.
Each version of .NET has an SDK and several runtimes. The SDK allows you to compile .NET programs. The runtimes allow you to execute them.
Runtimes
You cannot run an application that was compiled for .NET or .NET Core
unless you've installed the matching runtime on your computer. For example,
you must have the .NET Core 3.1 Runtime
to execute an application that
targets .NET Core 3.1
.
If one of your applications targets .NET 5
and another targets .NET Core 3.1
then you require 2 runtimes; one for each version. The .NET 5 Runtime
isn't enough.
If you don't have the correct runtime you'll see an error which includes:
"The framework 'Microsoft.NETCore.App', version 'x.x.x' was not found."
Checking Installed Runtimes
Run the following command to check the runtimes that have been installed on your computer:
dotnet --list-runtimes
The output will look something like this:
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
This example has the .NET runtimes for both .NET Core 3.1
and .NET 5
.
It can execute a Python script that uses an API. It can also execute a .NET application which
targets .NET Core 3.1
or .NET 5
.
Installing Runtimes
You can download additional runtimes if required. Select the ".NET Runtime x.x.x" package.
See Installing Prerequisites Without Admin Rights if you need to install the runtime on a Windows PC without Administrator rights.
SDKs
You must install an SDK to compile .NET applications. SDKs are backwards compatible
unlike runtimes. You can compile a .NET Core 3.1
application with the .NET 5 SDK
You must install either .NET Core 3.1
or .NET 5 SDK
or later to install the
latest version of Python.NET.
Checking the SDK
Run the following command to check the runtimes that have been installed on your computer:
dotnet --list-sdks
The output will look something like this:
5.0.201 [C:\Program Files\dotnet\sdk]
That computer has .NET 5.0 SDK
installed:
Installing an SDK
You can download SDKs from here if required. Select the "SDK x.x.x" package.
See Installing Prerequisites Without Admin Rights if you need to install an SDK on a Windows PC without Administrator rights.
.NET Framework
".NET Framework" is Microsoft's name for the old version of .NET. It has been deprecated in favour of .NET Core and .NET. See above.