I haven't opened a Console Application in a hot minute but now I need it to run some benchmarks / complete an intake assignment. This is embarrassing, but I can't even get it set up right, and it's not like I'm a newbie.
I'm not doing anything special, it's just empty. Properties of the Solution are also completely empty, so that doesn't help much either.
Interestingly enough it didn't even include all language features, e.g. var span = "My String".AsSpan();
doesn't work.
Lastly I have .NET desktop development installed with .NET 7 included. Really confused as to what's wrong.
Steps to recreate:
I'm glad you were able to resolve the issue by reinstalling Visual Studio. This really shows that you are extremely lucky. Because usually reinstalling may not solve this issue.
The reason for saying this is because this issue is usually caused by a problem with the dotnet environment variables. To prove what I'm saying, I need to reproduce your problem first, like this:
Then the correct solution to this issue is:
You can modify the environment variables and find the path "This PC -> Right click 'Properties' -> Advanced system settings -> Environment Variables –> System variables –> double click path"-> Delete "C:\Program Files (x86) \dotnet" and make sure there is "C:\Program Files\dotnet".
Of course, it may also be because "C:\Program Files\dotnet" is not the correct path. This requires you to find the correct installation location of your dotnet and modify it.
Finally, when your dotnet environment variables are configured correctly, you will find that everything is normal when you re-create a console program.