views:

98

answers:

2

I have a couple of VS 2008 projects (C++) that are linked every time I start a build, even though nothing has changed. i.e. I select "Build Solution", it compiles and links, I select "Build Solution" again, it doesn't compile anything, but links again.

This is quite annoying and I have checked everything that might cause it to link again. Is there a way to find out why Visual Studio does or skips certain build steps?

Any input is appreciated!

A: 

Bit of a long shot but check the date/time stamp on any dependent DLLs you have. If they are in the future then a rebuild will occur.

Edit: Also have you tried opening the .vcproj files up in an editor to check if anything's unusual? You could also try recreating them from scratch, if that's possible.

Alex Angas
Good idea, but no luck. I checked all my harddrives and do not have a single file from the future...So I guess VS is expecting a file that isn't there...
Dietmar Hauser
A: 

I had some time to revisit the problem and a workmate gave me the tip to use "process monitor" from sysinternals to figure out which file is missing.

Lo and behold it worked! It turns out that Visual Studio insists on linking against a bunch of libs even if the app does not need it. Due to an unfortunate (I guess...) chain of events, one of the default library paths disappeared from Visual Studios global settings, so VS couldn't find this lib anymore ("coredll.lib" in my case).

This didn't affect the final output, because this lib is not needed at all, but it still triggered a relink every time.

There are two possible fixes: 1) Restore the path to this lib in the global Visual Studio settings 2) Use "$(NoInherit)" in AdditionalLibraries to get rid of the unneeded lib.

I used solution #1, because #2 needs to be done for each configuration of each project because can't be done via Property Sheets.

Dietmar Hauser