views:

125

answers:

2

I'm using Visual Studio 2008.

I have a solution with two projects. One builds a DLL, which is my "production code". The other builds a console app exe, which is my unit test suite.

For my unit test project, I have listed as linker inputs the names of the source modules from the DLL. I.e., I have a DLLMain.cpp in the DLL project, and a linker input "DLLMain" in the exe project. This allows the exe to link with the obj files produced by the DLL project, preventing recompilation of those modules just for the unit tests. (Saves a lot of build time.)

THE PROBLEM IS that because the exe is produced later than the obj's, and by a different project, its timestamp is always newer than the obj's. So when you try to run or debug, it ALWAYS says the exe project is out of date and needs to be rebuilt.

Is there some way I can configure the exe project to ignore the timestamps? Or is there some other, perhaps more general, solution I'm not seeing here?

A: 

Seems like you are creating foo.obj in the DLL's project, linking foo.obj in the DLL project to produce the DLL, and then linking foo.obj to your EXE project without first recompiling it.

I have never done this before, but first thing I would check is to make sure the Intermediate Directory settings are the same for both the EXE project and the DLL project.

John Dibling
A: 

Go to the project that is not needed for unit testing
Right click on it and press Properties
Click on Configuration manager
Add a new configuration using the first drop down list
Click ok
Select that configuration in the window that is now focused
then in configuration properties set "Excluded From Build" to yes

Eric Fode
I'm not sure what the aim of your answer is... I don't want two separate build targets. I want one configuration that builds both my production DLL and my unit tests. I have this currently, but the unit test project is never ever up-to-date.
gg3