If you very recently installed the .NET SDK --
If you had Visual Studio Code open at the time you installed the .NET SDK,
and you haven't restarted it, you should do so.
On Windows, on some machines, environment variable changes don't immediately take effect.
Restart your computer to see if that resolves this problem.