We're still a little early in setting up our build automation and just using a bat file for now for Win32 C++ solutions. We have about 4 solutions and each has a couple vcproj files.
Each time a new solution or configuration is added I have to update the bat file to reflect the new solution or configuration to call with MSBuild.
I thought perhaps it would be easier to write a tool that parses all the sln files in a given path (and its subtree) and then parse all project files it references for configurations and then call all the builds that way.
Is there an easy way to do this?
Really this is 2 questions:
-
How can I tell MSBuild just to build all solutions inside a subtree? (I can do a search on them – that is a simple tool I think to write)
-
How can I tell MSBuild to build all configurations of a solution/vcproj?
We're using MSBuild, bat files, vc2008, c++
Best Answer
Being a PowerShell fan the following reformatted one-liner might be of help:
This script can be saved as a ps1 file or pasted as a function in your profile. To explain what it does:
--edit: Forgot Split-String is part of PSCX, it's better to use [string] I hope this helps. If you still would like to use MsBuild, it does support a recursive form of the file glob operator via the ".\**\*.sln" syntax see here for details. MsBuild also provides the MsBuild task which can be used to build a set of solutions. I do not know how you can get all 'known' configurations from a solution easily in msbuild. Therefore I choose the PowerShell route.