The current NET SDK does not support targeting NET 7.0. Either target . NET 6.0 or lower, or use a version of the NET SDK that supports .NET 7.0.
This error message is indicating that the version of the .NET SDK that you are currently using does not support targeting .NET 7.0. In order to resolve this error, you have three options:
- Update your Visual Studio instance to the latest available.
- Target .NET 6.0 or lower in your application by modifying the target framework in your project file (e.g.
.csproj
) to a version lower than 7.0, and then rebuild your application. - Use a version of the .NET SDK that supports .NET 7.0. You can check the version of the SDK you are currently using by running
dotnet --version
in a command prompt or terminal, and then update it to the latest version that supports .NET 7.0.- You can check the SDK version by running dotnet –list-sdks and you can update your SDK version by running dotnet update sdk
- Once you have updated your SDK version, you should be able to build your application targeting .NET 7.0 without encountering this error.
running dotnet –version in a command prompt or terminal, … this has never worked for me. There must be something that you need to do in the command prompt or terminal in order for it to recognize these commands.
On MacOS, you need to make sure your terminal has this alias registered