Ask the Expert

Is there a command prompt menu option in VS.NET?

I might be mistaken, but I distinctly remember a beta release of VS.NET that had a menu option that took you to a command prompt set to the context of your current project. I can't find it in the release version of VS.NET. Was it taken out, was it never there, or is it hidden away somewhere?
While I don't remember the functionality you're speaking of ever being in VS.NET, I know exactly what you mean, because I often need the ability to pop up a command prompt in my project's directory, with the full suite of .NET SDK tools provided for in my path. Setting the path can be accomplished using the Visual Studio .NET Command Prompt item from the Start -> Programs -> Microsoft Visual Studio .NET -> Visual Studio Tools menu, which launches the Windows command shell and runs the C:Program FilesMicrosoft Visual Studio .NETCommon7Toolsvsvars32.bat batch file. I often place this shortcut on my Quick Launch toolbar to save me digging into the menus.

However, this shortcut will put me into a folder deep in the Program Files folder, which is never where I want to be. Where I want to be is in the project directory of my current VS.NET project. To set that up, add a new External Tool to VS.NET by choosing External Tool from the VS.NET Tools menu and add a new tool that looks like this:

External Tools dialogue box in VS.NET

The title of the tool is whatever you like, but by putting & in the title, you can set the menu item shortcut key (I like S). The Command is the path to the command shell on your system. (It's c:windowssystem32cmd.exe on mine.) The Arguments are "/k" following by the path to vsvars32.bat on your system, which means execute the batch file and keep the shell executing. The Initial directory is a variable which represents the currently active project in VS.NET. $(SolutionDir) is another good choice, if you'd like to not worry about choosing the property project before executing this command. When you execute this new tool, you'll get a new command shell in the current project's directory all set up with the appropriate path.

Also, if you'd like to do the same thing for the File Explorer, set the Command to the path to explorer.exe and the Arguments to the $(ProjectDir) or $(SolutionDir) in double quotes, which will cause Explorer to open that folder for you.

This was first published in November 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: