Use devenv to compile the method of the project on the command line

  • 2020-06-01 10:35:57
  • OfStack

This article shows you how to run an Visual Studio compilation project using the command line.

1. devenv is introduced

devenv is the executable program of VisualStudio, 1 as in ".. \Microsoft Visual Studio 12.0\Common7\IDE "for running Visual Studio.

Compile an instance of the project using devenv:

devenv D:\Build\MyProject\Src\MyProject.sln /Build "Debug|x64" 

2. Help with the use of devenv

1. How to get help

 in cmd In the input  devenv /?

2. Use help

Here is the detailed help:


devenv [solution file | project file | any file. Extension] [switch]

The first parameter of devenv is usually a solution file or project file.

If you want to open the file automatically in the editor,

You can also use any other file as the first parameter. When you enter the project file, IDE

The parent directory of the project file is searched for the same as the project file

Base name of the.sln file. If such a.sln file does not exist,

IDE looks for a single.sln file that references the project. If there were no such single thing

For the.sln file, IDE will create an unsaved file with the default.sln file name

The base name is the same as the base name of the project file.

Command line generation:

devenv /build [solution configuration] [/project project name or file [/projectconfig name]]

Available command-line switches:

/Build generates a solution or project using the specified solution configuration. For example "Debug". If multiple platforms may exist, the configuration name must be enclosed in quotation marks and include the platform name. For example, "Debug | Win32".

/Clean delete generates results.

Start IDE and execute the command.

/Deploy generates and deploys the specified build configuration.

/Edit opens the specified file in the running instance of this application. If there is no running instance, start a new instance with a simplified window layout.

/LCID sets the default language for the user interface in IDE.

/Log records IDE activities to the specified file for troubleshooting purposes.

/NoVSIP disables the VSIP developer license key for VSIP testing.

/Out appends the generated log to the specified file.

/Project specifies the project to build, clean up, or deploy. Must be used with /Build, /Rebuild, /Clean or /Deploy 1.

/ProjectConfig overrides the project configuration specified in the solution configuration. For example "Debug". If possible

For multiple platforms, the configuration name must be enclosed in quotation marks and include the platform name. For example, "Debug | Win32". Must be used with /Project 1.

/Rebuild cleans first and then generates a solution or project using the specified configuration.

/ResetAddin removes the commands and command user interface associated with a particular add-in.

/ResetSettings restores the default Settings of IDE and can also be reset to the specified VSSettings file.

/ResetSkipPkgs clears all SkipLoading tags added to VSPackages.

/Run compiles and runs the specified solution.

Compile and run the specified solution, then close IDE.

Launch IDE in safe mode and load the minimum number of Windows.

/Upgrade upgrade project or solution and all projects within it. And create backups of these files accordingly. For more information about the backup process, see the help section on the Visual Studio transformation wizard.

Product-specific switches:

/componentsDiff compares two component folders. Three parameters are required: OptionalTfsServerCollectionUri SourceVersionedServerFolderPath TargetVersionedServerFolderPath if OptionalTfsServerCollectionUri is not provided, try using the current TFS project collection.

/debugexe opens the specified executable file to debug. Pass the rest of the command line as arguments to this executable.

/diff compare two files. Take four parameters: SourceFile, TargetFile, SourceDisplayName (optional), TargetDisplayName (optional)

/openProjects /scc:git opens the submitted project from Git.


/repositoryUrl (/repo):
/commitId (/id):
/solution (/sln):

/openProjects /scc:tfs opens the version control project from tfs.


/collection (/col):
/solution (/sln):

If OptionalTfsServerCollectionUri is not provided, then

Try using the current TFS project collection.

/sqldbaction Start SQL Server Data Tools and perform the action specified in the argument string.

/TfsLink opens the team explorer and launches the viewer for the provided project URI

(if the project URI is registered).

/useenv USES PATH, INCLUDE, LIBPATH, and LIB environment variables

Instead of using the IDE path generated by VC++.

To attach a debugger from the command line, use:

VsJITDebugger.exe -p < pid >

Related articles: