Click here to Skip to main content
Click here to Skip to main content

How to Add the Visual Studio Command Prompt (VSCP) to your IDE as a tool

By , 12 Mar 2008
 

Introduction

This article explains how to add the Visual Studio Command Prompt (VSCP) to your IDE as a tool.

Background

As a seasoned developer using Microsoft technologies, you may have used the Visual Studio Command Prompt for various reasons. It may be for creating Strong Names, or for adding binaries to the GAC, or for viewing Intermediate Language code of the code you write, etc. Whatever be the reason for using the VSCP, we normally move away form our working environment and access the command prompt by using these steps:

  • Start -> Programs
    • Microsoft Visual Studio (version)
    • Visual Studio Tools
    • Visual Studio Command Prompt

    (The steps may change based on the version of the Operating System and Visual Studio installed.)

How to add VSCP to your IDE

We can add the VSCP as a tool in the IDE so it will be very easy to access the VSCP from the IDE itself.

  1. In your IDE, go to Tools -> External Tools..
  2. Click on the Add button.
    1. Give a title of your own like “Command Prompt”.
    2. In the ‘Command’ area, specify the path either by typing “C:\Windows\System32\cmd.exe” or by browsing to the folder “C:\Windows\System32” and selecting cmd.exe.
    3. In the arguments area, specify the text "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat".
    4. Set the Initial Directory to the solution directory.
  3. Click on the OK button.
  4. Now, the Visual Studio Command Prompt is available in the IDE tools menu.

Whenever you need the command prompt in the IDE, you can use this tool option and the command prompt will be available.

Addition

Now, you may ask the question “what is the difference between the system command prompt and the VSCP?”

We can consider the VSCP as just a wrapper of the system command prompt. The VSCP will simply load the environment settings for the .NET framework so that you can use any of the framework tools in the command prompt and execute it without any errors like '...not recognized as an internal or external command..'. It is not necessary that we should use VSCP for using Visual Studio tools like sn.exe, gacutil.exe, etc. If you have set the environment variables properly for executing Visual Studio commands, you can use the system command prompt itself to use Visual Studio tools. Otherwise, you will get an error.

What is vsvars32.bat?

Go to step 2. c, and you can notice the argument vsvars32.bat. What is this vsvars32.bat? It is simply a batch file setting the environment variables for the .NET framework tools. You can navigate to C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\ (in the case of Visual Studio 2008) and open the batch file vsvars32.bat for editing, and you will get a clear picture on the environment variable settings for the .NET Framework.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

V K Sumesh
Team Leader Photon Infotech, Chennai
India India
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalworks by adding arguments asmembersamir411803 Sep '10 - 6:05 
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
GeneralWorked fine once I added /k before the vsvars32.bat argumentmemberMember 157155025 May '09 - 23:35 
Not sure why. Also, I forgot to double-quote the path + vsvars32.bat file which held me up for a bit. Many thanks.
GeneralRe: Worked fine once I added /k before the vsvars32.bat argumentmemberAlfons van Zwol8 Jul '09 - 1:32 
Hi V K Sumesh,
 
Thanks for your article. It helped me a lot.
But could you adapt the remarks of Member 1571550 to your article, please? He is right, /K has to be placed in front of the argument. See the help of cmd.exe:

>cmd /?
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
...

 
And could you tell the readers to pay attention to the double-quotes for the argument as well?
 
Regards
GeneralGood ArticlememberAnjum.Rizwi4 Feb '09 - 0:44 
Excellent Sumesh!!!
 
Good finding for shortest path.
 
Hope It will will help.
 
Thank You,
Anjum Rizwi

QuestionFor Professional ProgrammermemberBillGets2 Apr '08 - 23:33 
How To Convert Windows Comman Smile | :) d Prompt To VS 2008 Command Prompt

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 12 Mar 2008
Article Copyright 2008 by V K Sumesh
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid