How to run VS Code program on command prompt? - cmd

New to both VS Code and Visual Studio... When I run my C# program in Visual Studio, the command prompt opens and the program is run there. In VS Code however, the program is run in the integrated debug console.
Is there a way I can set VS Code to open up cmd prompt and run my program there, rather than the VS Code debug console?
Thanks.

Go to settings and search "Terminal: Explorer Kind". Then set it to external select external.

Related

Executing terminal app and Triggering go golang visual studio code debugging with delve from terminal

I would like to tigger visual studio code debugging of *.go files from the terminal.
I also need to be able to pass command line arguments which I have already working. These command line arguments are set based on bash variables I exported. I want to attach through the terminal without going directly in visual studio to attach.
Is this possible?
e.g. something like dlv debug *.go --user=john

How to add batch file in windows environment variable

I am following the installation guide for openvino on Windows. After a successful installation, we need to run setupvars.bat file in order to initialize the openvino environment. We can also add it permanently in environment variable so that it is initialized automatically. But the instructions are not given on how to add it.
I wanted to know if its possible to add the setupvars.bat so the it runs automatically. Also I need to run the visual studio from the same environment.
I always do this step manually which takes a lot time. I first open a cmd, navigate to the desired folder and then run setupvars.bat. After that from the same cmd, I navigate to the visual studio installed directory and then start the visual studio from the cmd so that visual studio is launched under same openvino environment. Is is possible to automate all this task. Thanks
Solution 1: You can set the environment variables for the visual studio as mentioned here - How do I set specific environment variables when debugging in Visual Studio?
Solution 2: Write one more batch file which will 1st call setupvars.bat & then open the visual studio. Then you can run the new bat file.
Solution 3: You can create a cmd shortcut like this - Run a Command Prompt command from Desktop Shortcut
In this, you can 1st call setupvars.bat and then cmd to open Visual Studio. Once you click the new shortcut both the things should happen automatically. You can even add this step along with the installer.

Obtain visual studio generated build command

I want to create a batch file for building releases of a multi-solution software. What I am curious about how may I obtain the exact MSBuild command that Visual Studio executes when I click on "Rebuild Solution"?
It is equivalent to
MsBuild /t:Rebuild /p:Configuration=<config>;Platform=<platform>
although VS actually generates a temporary msbuild file from the solution and then builds that. You get the file by setting an MSBuildEmitSolution environment variable:
open a VS command window
enter set MSBuildEmitSolution=1
enter devenv to open a VS instance within that command window so it uses the MSBuildEmitSolution environment variable
open and build your solution

Env vars for Visual Studio command prompt

I'm doing an RDP into a machine that has just the CLR installed, and doesn't have Visual Studio on it. Can I somehow load all the Visual Studio-specific environment variables on to the regular command prompt and convert it into the VS command prompt so that I'm able to build my projects via command line?
I looked at the vcvarsall.bat file. That calls the appropriate processor-specific batch file. Couldn't get any inputs from there.
Short of installing all VS, or tracing thru all the various batch files to find out what's getting set, you may be able to simply capture the env vars that are set.
Open up a VS command prompt, and run set > vars.bat
Then open up vars.bat, and put a set command in front of each line.
Not sure how much this will help, since you're going to be missing all the utilities that come with Visual Studio, but it does answer your question.
I don't recommend trying to copy only what you need. You'll need other header files, libraries, dlls, etc... You can instead install VS express edition.
If you are trying to debug a problem you can use remote debugging in Visual Studio or use WinDbg on the computer.

How can i debug in visual studio as command line?

I hav my execuatable produced by command line building.
I want to debug it in command line itself as like as gdb does in linux.
Also i want run my program in Visual studio GUI from command line options..
How can i do that?
Make sure it is compiled in the debug version. Run the program. Then "Attach to Process" from VS tools menu.
You can also specify the runtime options when running the debugger (it's in the project properties).
I don't think that VS has a pure command line mode, but you could use CDB/NTSD.
http://msdn.microsoft.com/en-us/library/cc266320.aspx
It is what lots of developers at MS do.

Resources