Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Builds a solution or project using a specified solution configuration file.
Syntax
devenv SolutionName /Build [SolnConfigName [/Project ProjName [/ProjectConfig ProjConfigName]] [/Out OutputFilename]]
Arguments
SolutionName
Required. The path and name of the solution file, relative to the solution's directory.
SolnConfigName
Optional. The name of the solution configuration (such as
DebugorRelease) to be used to build the solution named in SolutionName. If multiple solution platforms are available, you must also specify the platform (for example,Debug|Win32). If this argument is unspecified or an empty string (""), the tool uses the solution's active configuration./ProjectProjNameOptional. The path and name of a project file within the solution. You can enter a relative path from the SolutionName folder to the project file, or the project's display name, or the full path and name of the project file.
/ProjectConfigProjConfigNameOptional. The name of a project build configuration (such as
DebugorRelease) to be used when building the named project. If more than one solution platform is available, you must also specify the platform (for example,Debug|Win32). If this switch is specified, it overrides the SolnConfigName argument./OutOutputFilenameOptional. The name of a file that you want to send the tool's output to. If the file already exists, the tool appends the output to the end of the file.
Remarks
The
/Buildswitch performs the same function as the Build Solution menu command within the integrated development environment (IDE).Enclose strings that include spaces in double quotes.
Summary information for builds, including errors, can be displayed in the command window, or in any log file specified with the
/Outswitch.The
/Buildswitch only builds projects that have changed since the last build. To build all projects in a solution, use /rebuild instead.If you get an error message that says Invalid project configuration, make sure that you've specified a solution platform or project platform (for example,
Debug|Win32).
Examples
The following command builds the project CSharpWinApp, using the Debug project build configuration within MySolution.
devenv "%USERPROFILE%\source\repos\MySolution.sln" /build Debug /project "CSharpWinApp\CSharpWinApp.csproj" /projectconfig Debug
And to clean up all the build files:
devenv "%USERPROFILE%\source\repos\MySolution.sln" /clean
Build a setup project
To build an installer (.msi file), you need a setup project, which has a .vdproj project file, but to build it you first need to apply a workaround that sets a particular registry key. From the Visual Studio Developer command prompt, run the executable DisableOutOfProcBuild.exe from the folder Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild. Without this workaround, you may get the error: ERROR: An error occurred while validating. HRESULT = '8000000A'. The command affects the current user, so for build agent scenarios, be sure to run it from the same account that runs the build. For more information, see the README.txt file in the same folder.
Also, in Visual Studio, you can create a new configuration, say Setup, based on the Release configuration, and select the setup project as a project to build. By default, setup projects aren't included in the default configurations, Debug and Release. With the Setup configuration defined, the following commands build a project WindowsFormsApp1 and its associated setup project to generate the .msi file:
devenv WindowsFormsApp1.sln /build Setup
If the solution was already built with the Release configuration, this command just builds the setup project.