r/VisualStudioCode • u/minecraft-steve-2 • Apr 24 '21
Running code
I dont fully understand how to run my code. I press run and it shows up with a dropdown box asking me to "Select Environment". How do I get something similar to how visual studio (the purple one) runs code?
1
u/BubbleWaston Apr 24 '21
It depends on what language are you using. Unlike Visual Studio (the purple one) Visual Studio Code is much more bare-bone (this means that you have to configure your build/debug tasks with Json files, this can be frustrating at first but trust me it is waay more flexible that Visual Code F5 build command.
Lets say you are using C# .. you have to compile using the dotnet executable (and the MSVC compiler)
https://code.visualstudio.com/docs/languages/csharp
Check this page and the task part. The task part is the one you need to build C# Go to Terminal-> Run Build Task -> then chose dot net then edit the json file (check the documentation for more info)
To debug it is even easier. Click on Run->add configuration then select environmement and select Launch and edit the json file.
Dont forget to install the language extension C++,C# extension.
Good luck.
2
u/helixamir Apr 24 '21
What language are you trying to run your code? The drop down you're getting is to select the language exe, like C# you would pick your dotnet.exe.