Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I build all with MSBuild from the command line?

Is this valid?

MSBuild /t=all /configuration=all

I want to build ALL configurations of all projects in a sln file, etc from the command line using MSBuild in Visual Studio 2008.

I do not want to have to specify them when I call MSBuild, the sln/proj files all have that information. I don't want to change my build script if I add configurations to project files.

So for the target I can use BuildAll. If I leave the configuration empty will it build all or is "BuildALL" valid for configuration as well?

EDIT

essentially what I am asking is given an SLN or VCProj file, I want msbuild to iterate all configurations and build it itself, or alternatively some mechanism that will discover them so I don't have to specifically list them on the command line or in a script.

i.e. I don't want to update my build script when I add or remove a configuration. That seems like a pretty reasonable thing to want to do.

like image 390
Tim Avatar asked May 09 '09 04:05

Tim


People also ask

How do I run MSBuild from command line?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

How do I create multiple projects in MSBuild?

You can use MSBuild to build multiple projects faster by running them in parallel. To run builds in parallel, you use the following settings on a multi-core or multiple processor computer: The -maxcpucount switch at a command prompt. The BuildInParallel task parameter on an MSBuild task.

Which is the initial step needed when using the MSBuild at the command prompt?

Build the targettargets file. Run MSBuild from the Developer Command Prompt for Visual Studio to build the HelloWorld target defined above. Use the -target or -t command-line switch to select the target.


1 Answers

You can't by default build all configurations using MSBuild command line options. In order to do this you need to create a new target (VS Project).

The way I do it is:

msbuild /t:BuildAll /Configuration:"Debug;Release;ContinuousIntegration"

I make a standard Target, and call it BuildAll, and for every project I wanted to automate, I'd just create that Target and make it depend on all the targets you want to build automatically.

like image 188
John Weldon Avatar answered Oct 11 '22 19:10

John Weldon