I have a C++ solution with 4 projects and 24 configurations. The projects are cryptest
, cryptlib
, cryptdll
and dlltest
. And then there's a partial cross product of x86, x64, debug, release, DLL export, and DLL import.
There's a not-so-apparent dependency that I can't seem to express under the UI or by modifying the project files by hand. The dependency is all the DLL related projects depend upon cryptest, Release Win32
.
Visual Studio allows us to build all configurations by selecting the Build menu, and then Batch Build... → Select All → Build. When I perform a Build All, the first configuration built is:
------ Build started: Project: cryptlib, Configuration: DLL-Import Debug x64 ------
Performing Custom Build Step
Assembling: c:\Documents and Settings\cryptopp-5.6.3\x64masm.asm
Performing Custom Build Step
Compiling...
pch.cpp
...
As can be seen above, the machinery chooses cryptlib, DLL-Import Debug x64
as its first choice. I want the following order:
cryptlib, Release Win32
cryptest, Release Win32
- Don't care about remaining 22....
The problem is I cannot tell Visual studio that all Win32 and x64 DLL projects depend upon the Win32 cryptest
.
How can I control the order of Batch Build → Build All?
Currently I have to run through Build All twice. The first ends with:
========== Build: 20 succeeded, 4 failed, 0 up-to-date, 0 skipped ==========
The second run ends with:
========== Build: 4 succeeded, 0 failed, 20 up-to-date, 0 skipped ==========
When reordering the solution file's GlobalSection(ProjectConfigurationPlatforms)
with a text editor (and placing them in the exact order I want), these are the kind of warm and fuzzy results I encounter. The 24 configurations will build with Build All under Visual Studio 2005, but Build All does nothing (literally, nothing) under Visual Studio 2008 after testing an upgrade.
And when I manually try to build a project (right click project, then Build), I get a result like:
1>------ Skipped Build: Project: cryptlib ------
1>
2>------ Skipped Build: Project: cryptest ------
2>
With no reasons or explanations. It sure would be nice if Visual Studio provided a log file in an attempt to decipher the behavior.
A related issue is Visual Studio selects << some project >> as the default Startup project with no declarative way to change it. That means a particular project needs to be the first one listed in the solution file, and that cannot change.
I'm having a hard time finding a solution that is amicable to both Visual Studio 2005 (how the source files are distributed) and a post-Visual Studio 2010 upgrade (how some folks use it).
I can kind of find some information on the subject, like Project settings changes with VS2010 from a blog. But its not really clear how to effect a dependency change as described above, and the blog only applies to VS2010 or above.