共用方式為


/Build (devenv.exe)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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 Debug or Release) 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.

  • /Project ProjName

    Optional. 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.

  • /ProjectConfig ProjConfigName

    Optional. The name of a project build configuration (such as Debug or Release) 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.

  • /Out OutputFilename

    Optional. 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 /Build switch 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 /Out switch.

  • The /Build switch 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).

Example

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

See also