We needed to automate testing that all of the C#, C++, & VB.NET samples we ship compile properly. We need it to build all files without our listing each one. Listing each one means if someone forgets to add a new one (which will happen someday), explicit calls will miss it. By walking all .sln files, we always get everything.
Doing this is pretty easy:
- Install the samples on a clean VM (that we revert back to the snapshot for each test run).
- Create a BuildAll.proj (MSBuild) file that calls all the .sln files installed.
- Use MSBuild to run the generated BuildAll.proj file
Step 2 requires a means to generate the BuildAll.proj file. Is there any way to tell MSBuild to run all .sln files under a sub-directory or to create a BuildAll.proj that calls all the underlying .slnl files?
We couldn’t find anything so we wrote a program that creates a BuildAll.proj that calls all .sln files under a directory. Full solution is at Windward Wrocks (my blog).
The code is: