Using VS - DevSource
DevSource: Microsoft Developer Resource DevSource Home Sponsored by Microsoft Home Add Ons Architecture Languages Techniques Using VS Forums
Home arrow Using VS arrow Working at the Visual Studio Command Line
Working at the Visual Studio Command Line
By John Mueller

Rate This Article: Add This Article To:

Working at the Visual Studio Command Line
( Page 1 of 3 )

Tired of clicking yourself to death in the Visual Studio IDE? A command line switch may be just what you need.

You may not realize that the Visual Studio IDE supports command line switches, but it does. The command line switches can do everything from changing your work environment to compiling your application.

One benefit of using the command line switches, rather than locating the corresponding feature using the menu system, is that you can automate some tasks. For example, you can compile your application without even displaying the IDE.

ADVERTISEMENT

In many cases, using a command line switch is simply convenient. For example, you can use the command line to load a local Web site directly, rather than waste time drilling down into your hard drive looking for the Web site you want to load.

Accessing the Command Line

You might think that accessing the command line is a simple matter of clicking the Start\Programs\Accessories\Command Prompt shortcut. That shortcut opens a command prompt, but it's not the right one. This command prompt lacks the required environment variables, especially the path information to Visual Studio.

Instead, open a development command line by clicking the \Start\Programs\Microsoft Visual Studio\Visual Studio Tools\2005 Visual Studio 2005 Command Prompt shortcut. The command line you see is ready for use in development applications. Of course, you can easily create your own batch files with the required environment variables. Look at the vcvarsall.bat in the \Program Files\Microsoft Visual Studio 8\VC folder of your hard drive for an example of how to create such a batch file.

You access the development environment (the IDE) using the DevEnv command. If you ever forget the command line switches found in this article, you can display a list to refresh your memory by typing DevEnv /? and pressing Enter at the command line. Generally, you'll find that you can use the command line to open a solution, project, or specific file directly, with or without special environment or task related command line switches. Here's the command line syntax for DevEnv.

DevEnv [solutionfile | projectfile | anyfile.ext] [switches]

Changing Your Environment

Many developers set their environment one time, and they never change it. However, when performing certain tasks, you may find that one environment works better than does another. For example, you might want to use a multiple document interface (MDI) environment in some cases (such as working with complex applications) and not in others (building a utility). Here's the list of environment-related command line switches and my take on using them.

  • /LCID LocalID or /L LocalID: Specifies a locale identifier (LCID) for the development environment. This is an excellent option for someone who needs to work with multiple language environments. Using this command line switch, it's easy to change locales as needed during the development process. You can find a list of the common LCIDs here.
  • /FN FontName: Sets the name of the font used to display information on screen. If you perform many database and engineering type tasks in Visual Studio, you'll find that the ability to change fonts can save your eyes. Sometimes, the font used to write code doesn't work nearly as well for creating a database design.
  • /FS FontSize: Sets the size of the font used to display information on screen. Those late night coding sessions can become troublesome; the small font that works fine during the day becomes blurry at night. Using this option lets you upsize your viewing font without fiddling with the menus all the time.
  • /MDI: Places the IDE into the multiple document interface (MDI) mode. The MDI mode uses screen space more efficiently by eliminating features, such as the tabs that you normally see at the top of the display. You can still switch between editing windows by pressing Ctrl+Tab, or you can select a particular window from the Window menu. Use this option when you're focusing attention on a few documents, rather than making small changes to many documents. Using this command line switch also sets the Multiple Documents option found in the General\Environment folder of the Options dialog box.
  • /MDITabs: Places the IDE into the tabbed mode. The tabbed mode displays tabs for open documents across the top of the screen, providing faster access to documents, albeit with some loss of screen real estate. Use this option when you need to make edits on a number of documents and move quickly from document-to-document during testing. Using this command line switch also sets the Tabbed Documents option found in the General\Environment folder of the Options dialog box.
  • /MigrateSettings: Moves the settings from a previous version of Visual Studio to a new version of Visual Studio. Using this command line switch, you can configure a new Visual Studio setup quickly. Otherwise, you end up resorting to manual registry manipulation, which is error-prone at best.


  •  
     
    >>> More Using VS Articles          >>> More By John Mueller
     



    Microsoft's Future: A Chat With Their CTO, Barry Briggs

    Play Video >

    All Videos >

    Julia explores the Robotics Studio!

    Read now >

    Messages to Bill Gates!

    Read now >

    View Now
    DevSource RSS FEEDS
    XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.