For various C++ library projects in VS2008 I have a sibling project called <libraryname>-Test
. This is an executable project that depends on the library and runs tests on it. The post-build configuration of the test project consists of simply:
"$(TargetPath)"
Visual Studio won't re-run the post-build step unless it actually does something during the build, a re-link at the least. Normally that's a good thing, but in this case I want the tests to be re-run each time the solution build is triggered (as opposed to project builds which build only the dependent projects needed for the real program).
So far, the only way I've found to cause the tests to be run each time is to delete one of the intermediate files as part of the post-build process. This works, but slows things way down, as the test projects then need to be rebuilt even when nothing has changed.