I am facing this error since I restarted the system. I am not sure what went wrong. I have restarted my system many times. Please help.
CodePudding user response:
Is this happening when you open a solution / project or when you just open visual studio with a blank solution ?
You could try deleting your global.json file (or rename it so you have a backup), that should ensure you use the latest sdk installed.
If that does not work, try running
dotnet --list-sdks
and
dotnet --list-runtimes
and update your question with the info.
If you want to run a specific SDK version, post your global.json as well.
CodePudding user response:
Either your dot net core installation has a problem, or the project settings are messed up.
Based on my experience, you should do the following (in order, in case one step doesn't work, go to the next one).
- Create an empty dot net core project and print something. If it works, then your dot net core installation is correct.
- Check the project settings (right click on the project, properties). Check that it has the correct dot net version. Are you sure it was originally a dot net core project and not a dot net framework? Change it to the correct version if necessary.
- If nothing works, create a new project with the same dot net core version as the one you did in Step 1, and copy your files. Sometimes Visual Studio settings get messed up inside a project.
Hope this helps!