VS Code = Visual Studio Code
VS = Visual Studio
They are two different programs.
Visual Studio Code (VS Code)
For VS Code, please follow the instruction on this website and make sure all required extensions are installed: Unity Development with VS Code
If the issue persists, please check the console of VS Code (not Unity!). If the .NET Framework 4.7.1 (Developer Pack) is mentioned there, download and install it from the official Microsoft website. Make sure that you install this exact version. Other versions do not work.
If you use Linux or a Mac, download the latest stable MONO Framework.
On August 3rd, 2023, the following article was posted on the official Microsoft webseite. Their new extension is still new and might not work well yet. However, if nothing else helped, you could test it.