views:

439

answers:

4

In Visual Studio 2005, I have a solution with explicit dependencies specified via the Project Dependencies dialog.

When I build via devenv /rebuild Release for example, the projects are built in a different order than when loading up the IDE. This is an order not allowed by my specified dependencies.

In some cases, devenv crashes :(

The log shows a number before each line showing an order, which I believe is the dependency-induced order:

11>MyExeProject - 1 error(s), 0 warning(s)

However, the builds appear to be started in that order, interrupted and continue in another order - which does not work. So 8 may finish its build before 11. If 11 links in 8, there is a problem.

A similar reordering happens in the IDE, but the build order still maintains integrity.

Need to build by command line, any ideas why this is or what the cause is?

A: 

Make sure that you have set your dependancies in the solution correctly. This can directly affect build order.

Brody
A: 

If devenv didn't crash for you when building in the IDE, you've been lucky.

The following workaround is obnoxious but it worked for me, sigh. Reboot and set the BIOS to allow only a single CPU core to run.

Windows programmer
Its interesting you say that, I see in task manager, multiple copies of cl.exe running at times.
theschmitzer
Of course we want multiple copies of cl.exe to run, we want multiple cores to be used for their intended purpose, and we want devenv.exe to find some way to avoid crashing while doing so. Sigh.
Windows programmer
Then open up task manager and set the process affinity for the devenv solution.
Daemin
A: 

I tried recreating the solution and the problem reappeared???

However, I further investigated the crashed solution and found that one of the projects (Setup) ended up without a name.

Interesting... Especially because this problem appeared long after the last modification to Setup.

I removed Setup, it fixed the build order and crash.

theschmitzer
+3  A: 

Ok, here is the real answer, I believe.

Multiprocessor Builds are enabled. The dependency order is still enforced in the IDE, but not via command line, at least in VS 2005.

Turning it off is through Tools/Options/Build and Run. Set maximum to 1.

theschmitzer
Had a similar issue when I moved a build to a Multiprocessor system and found the same solution.
Philibert Perusse
It looks like this answer deserves to be accepted!
Windows programmer