Use the devenv command to run a specific version of Visual Studio - visual-studio

We have both Visual Studio 2010 and 2012 installed on our machine. Often we want to run it with the devenv command. To be clear, we want to open Visual Studio. How do we pass the version number to run? The devenv command line documentation doesn't say how.

Related

Access Visual Studio Developer Command Prompt from regular Command Prompt

This related question shows how to build and run a Visual Studio solution from Visual Studio Developer Command Prompt. My question is, is it possible to build and run a Visual Studio solution directly from the regular Windows Command Prompt (cmd.exe)?
Finally, I found the answer.
Access VS Developer Command Prompt from regular command prompt.
C:\Users\Hwathanie>cmd.exe /k ""C:\Program Files (x86)\Microsoft Visual
Studio 12.0\VC\vcvarsall.bat"" x86
Build the solution.
C:\Users\Hwathanie>msbuild "C:\Users\Hwathanie\Documents\Visual
Studio 2013\Projects\MyProject\MyProject.sln" /p:Configuration=Debug
Run the exe file created.
C:\Users\Hwathanie>"C:\Users\Hwathanie\Documents\Visual Studio 2
013\Projects\MyProject\bin\Debug\MyProject.exe"

Run Visual Studio 2010 with two commands

I want to run Visual Studio 2010 with two commands:
devenv.exe /nosplash
devenv.exe /safemode
How can I run Visual Studio 2010 with both commands? Meaning, I need to run an instance where both commands are executed with them.
How do I do this with Visual studio 2010?
Run it as:
devenv.exe /nosplash /safemode
It seems to work OK when I run it.
Unless I'm missing something here, simply type...
devenv.exe /nosplash /safemode
...and all should be well. (Tested and works fine on my set up.)

I get "operation cannot be completed" when i try to open visual studio 2010?

Hi I am getting the operation cannot be completed error when i tried to open Visual studio 2010. Previous to that I was trying to install web platform and didnt install but that is all I did...anyone have suggestions...i tried restart my pc...
Try devenv /setup, devenv /resetsettings, or devenv /resetuserdata. Important: only try the last two as a last resort since they will reset your settings.
Assuming you're on a 32-bit OS, devenv is available from the command-line at \Program Files\Microsoft Visual Studio 10.0\Common7\IDE or from the VS command prompt.

Do I need to run devenv.exe /setup twice? [VS 2005 and 2008]

I am writing a VS Integration Package and setup using Visual Studio Setup Package. I have a custom action that runs "devenv.exe /setup" when the package is installed.
If the user has VS 2005 and 2008 installed, do I need to run devenv.exe /setup from both directories? Like so:
"C:\Program Files\Microsoft\Visual Studio 8\Common7\IDE\devenv.exe /setup"
"C:\Program Files\Microsoft\Visual Studio 9.0\Common7\IDE\devenv.exe /setup"
Or will running just one be sufficient? If so, which one should I run? (2008 I presume)
Yes, you need to run both. They are two independent environments.
It depends on which one you are installing to. VSIP packages install into a version of Visual Studio vs. a machine. So you should only have to run devenv /setup on the version of Visual Studio to which your package installs. Running devenv /setup on the version you did not install to will have no effect.

How do I write a build batch script that runs vcvars32.bat, and then continues with the build?

I want to write a simple batch script that loads the Visual Studio build environment using vcvars32.bat and then continue with the build, using vcbuild. However, my script won't execute past the invocation of vcvars32.bat. The last output I get is:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
As you can see I'm using Visual Studio 2008. Here is my simplest batch script:
#echo off
"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
vcbuild
You have to use call in your batch script, or the termination of vcvars32.bat will terminate your own batch script. Therefore your script should be:
#echo off
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
vcbuild
You'll also want to check that the script hasn't run already or you'll start running out of memory if you invoke your script over and over in the same console.
IF '%VSINSTALLDIR%' NOT EQU '' THEN EXIT 0
The exact program files path depends on whether you have a 32 or 64 bit OS and where you installed Visual Studio. Use the VS100COMNTOOLS environment variable which Visual Studio sets up at install time to solve this problem generically.
call "%VS100COMNTOOLS%\..\..\VC\bin\vcvars32.bat"
...
Note that each version of Visual Studio has a specific environment variable based on its underlying version number.
Visual Studio 2005 VS80COMNTOOLS
Visual Studio 2008 VS90COMNTOOLS
Visual Studio 2010 VS100COMNTOOLS
Visual Studio 2012 VS110COMNTOOLS
Visual Studio 2013 VS120COMNTOOLS
Visual Studio 2014 VS130COMNTOOLS
Visual Studio 2015 VS140COMNTOOLS
Visual Studio 2016 VS150COMNTOOLS
Visual Studio 2017 VS160COMNTOOLS
You get the idea.

Resources