Q. I might be mistaken, but I distinctly remember a beta release of VS.NET that had a menu option that took 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?

Asked by reader. Answered by the Wonk on November 5, 2002

A.

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 Files\Microsoft Visual Studio .NET\Common7\Tools\vsvars32.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:

 

[Image]

 

The Title of the tool is whatever you like, but by putting & in the title, you can set the menu item short cut key (I like S). The Command is the path to the command shell on your system (it’s c:\windows\system32\cmd.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.

Feedback Responses

Aaron Clauson mentions that you can run the sample that comes with the .NET Framework SDK that deals with Shell Extensions and you can get the command option in your explorer context menu.

Feedback

I have feedback on this Ask The Wonk answer