1 - You have to make sure visual code is closed.
2 - Download these 2 installation from official website:
Download Link (.NET): https://dotnet.microsoft.com/en-us/download/dotnet
Download Link (.NET Framework): https://dotnet.microsoft.com/en-us/download/dotnet-framework/net471
3 - Make sure again that visual code is closed -> install both files-> run VSCode.
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.