Devenv Command Line Switches
Devenv lets you set various options for the integrated development environment (IDE), and also build, debug, and deploy projects, from the command line. Use these switches to run the IDE from a script or a .bat file, for example, a nightly build script, or to start the IDE in a particular configuration.
For build-related tasks, it is now recommended that you use MSBuild instead of devenv. For more information, see MSBuild Command-Line Reference.
By default, devenv commands pass switches to the devenv.com utility.
The devenv.com utility provides for the delivery of output through standard system streams, such as stdout and stderr, and determines the appropriate I/O redirection when it captures output, for example, to a .txt file. Commands that begin instead with devenv.exe can use the same switches, but will send them to the devenv.exe program, bypassing the devenv.com utility.
The syntax rules for devenv switches resemble those for other DOS command-line utilities. The following syntax rules apply to all devenv switches and their arguments:
Commands begin with devenv.
Switches are not case-sensitive.
When specifying a solution or project, the first argument is the name of the solution file or project file, including file path.
If the first argument is a file that is not a solution or project, that file will open in the appropriate editor, in a new instance of the IDE.
When you supply a project file name instead of a solution file name, a devenv command will search the parent folder of the project file for a solution file that has the same name. For example, the command devenv /build myproject1.vbproj will search the parent folder for a solution file that is named "myproject1.sln".
One and only one solution file that references this project should be located in its parent folder. If the parent folder contains no solution file that references this project, or if the parent folder contains two or more solution files that reference it, then a temporary solution file will be created that is named for this project and references it.
When file paths and file names include spaces, you must enclose them in double quotation marks (""). For example, "c:\project a\".
Insert one space character between switches and arguments on the same line. For example, the command devenv /log output.txt opens the IDE and outputs all log information for that session to output.txt.
You cannot use pattern-matching syntax in devenv commands.
Use the following command-line switches to display the IDE and perform the described task.
Command line switch
Starts the IDE and executes the specified command.
Loads a Visual C++ executable under the control of the debugger. This switch is not available for Visual Basic or Visual C# executables. For more information, see Automatically start a process in the debugger.
/LCID (devenv.exe) or /l
Sets the default language for the IDE. If the specified language is not included in your installation of Visual Studio, this setting will be ignored.
Starts Visual Studio and logs all activity to the log file.
/Run (devenv.exe) or /r
Compiles and runs the specified solution.
Compiles and runs the specified solution, minimizes the IDE when the solution is run, and closes the IDE after the solution has finished running.
Causes the IDE to use PATH, INCLUDE, and LIB environment variables for Visual C++ compilation instead of the settings specified in the VC++ Directories section of Projects options in the Options dialog box. For more information, see Setting the Path and Environment Variables for Command-Line Builds
Opens the specified files in a running instance of this application. If there are no running instances, it will start a new instance with a simplified window layout.
Starts an instance of the Visual Studio IDE without loading the specified Add-in.
Starts Visual Studio in safe mode, and loads only the default environment and services, and shipped versions of third-party packages.
Clears all SkipLoading tags that have been added to VSPackages by users who want to avoid loading problem VSPackages.
Forces Visual Studio to merge resource metadata that describes menus, toolbars, and command groups, from all VSPackages available.
Use the following command line switches to perform the described task. These command-line switches do not display the IDE.
Command line switch
Displays help for devenv switches in the Command Prompt window.
Builds the specified solution or project according to the configuration of the specified solution.
Devenv myproj.csproj /build
Deletes any files created by the build command, without affecting source files.
Devenv myproj.csproj /clean
Builds the solution, along with files necessary for deployment, according to the solutions configuration.
Devenv myproj.csproj /deploy
Compares two files. Takes four parameters:SourceFile, TargetFile, SourceDisplayName(optional),TargetDisplayName(optional).
Registers project or item templates that are located in <VisualStudioInstallDir>\Common7\IDE\ProjectTemplates or <VisualStudioInstallDir>\Common7\IDE\ItemTemplates so that they can be accessed through the New Project and Add New Item dialog boxes.
Lets you specify a file to receive errors when you build.
Devenv myproj.csproj /build /out log.txt
The project to build, clean, or deploy. You can use this switch only if you have also supplied the /build, /rebuild, /clean, or /deploy switch.
Specifies the project configuration to build or deploy. You can use this switch only if you have also supplied the /project switch.
Cleans and then builds the specified solution or project according to the configuration of the specified solution.
Restores Visual Studio default settings. Optionally resets the settings to the specified .vssettings file.
Notifies Visual Studio to merge the Visual Studio packages on the system and check the MEF cache for any changes.
Upgrades the specified solution file and all its project files, or the specified project file, to the current Visual Studio formats for these files.