views:

37

answers:

3

I'd like to build all the configurations of a VS 2008 C++ project on the command line. Something like:

devenv TheProject.vcproj /build /nologo

But this doesn't work because the /build command insists on having a configuration following it like this:

devenv TheProject.vcproj /build "Release|Win32" /nologo

Is there a way to get a command line build of all configurations within the vcproj file?

A: 

Haven't used VS in a long time. But the project properties panel used to show the command line generated for linking and compiling a project for a particular configuration. It used to be under the Advanced tab. Will using that directly from the command line serve your purpose? This method will not use the VS IDE at all.

Alternatively,

Steps:

  1. Create a project which has a dependency on all other projects.

  2. Write a script which builds this project with different configurations sequentially. You cannot create a single configuration which encapsulates all other configurations.

Rajorshi
A: 

Not directly, but you can have projects depend on other projects - so you could have an 'all' or 'install' project with a dependacy of everything else.

Martin Beckett
+1  A: 

I was thinking you can do what you want with MSBUILD, but it appears that it isn't much better for this than DEVENV.

You still have to specify each configuration on the command line, although it would be easy to write a batch file to accomplish this with either MSBUILD or DEVENV.

It looks like previous versions of the development environment may have supported an "ALL" option, but VS 2008 does not.

http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/8701b3d0-d5c9-45fb-8dd4-e7700c8caca6/

Avalanchis
Writing a batch file to specify each configuration is difficult because I'm iterating dozens of *.vcproj files which don't have a consistent number of configurations. The script I use traverses the directory structure looking for these *.vcproj files. Its purpose it to make sure every project compiles, and I'd like to expand it to verify every configuration of every project compiles.
Charles
The *.vcproj files are XML, so you might consider writing a program to parse the project files and extract the configurations, and write the results to a batch file or MSBUILD configuration.
Avalanchis
Yes. That had occurred to me, but I was trying to avoid having to do that. You can imagine how simple my script currently is. Adding logic to parse the configurations out of the vcproj files would increase its size and complexity by magnitudes.
Charles