This blog post will show you how to fix the NETSDK1127 Error when using Visual Studio 2022 on Windows and C#.
This means your project references a .NET Core version that is unavailable on your system.
Understanding NETSDK1127
The error message means tha project is targeting a specific version of .NET Core that is either missing or has been improperly configured. You need to ensure that your development environment and the project’s requirements are compatible.
You need to ensure that your development environment and the project’s requirements are compatible.
Solution NETSDK1127 error
First, confirm the .NET Core version your project targets. You can find this information in the project file (.csproj
) under the <TargetFramework>
tag. Note the version specified there.
From Solution Explorer in Visual Studio, double-click on the .csproj file
As shown, the program is configured to use .NET version 6. At this stage, I have two options:
- Install .NET 6 on my machine, run the application, and resolve the error NETSDK1127
- Change the .NET version to the version running on my machine
Installing the Required .NET Core Version
If the required version isn’t installed, you’ll need to download it. Visit the official .NET download page and select the appropriate version. Make sure to choose the SDK (Software Development Kit) for compatibility with Visual Studio.
Change Version
To change the version of the application, I will edit the .csproj file and change the version to net8.0
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project>
Verifying the Installation
To check if the correct version is now installed, open a command prompt and run dotnet --list-sdks
. This command lists all installed SDKs, helping verify the newly installed version.
Building the Project
Return to Visual Studio and rebuild your project. This should resolve the NETSDK1127 error, as the necessary .NET Core version and its associated libraries are now available to your application.