C++ – How to build all with MSBuild from the command line

cmsbuildvisual-studio-2008

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.

Best Answer

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.