Some of the brilliance of MSBuild includes recognizing when source files have not changed and therefore avoiding a re-compile. However, despite possessing an OutDir property, MSBuild always uses the /obj/Debug (or /obj/Release) directory to perform the comparison. MSBuild uses this directory as a temporary folder to avoid contention issues.
In our case, our compiled DLLs reside in a separate directory named /build. Thus, with MSBuild writing DLLs into the /obj/Debug directory, it would always rebuild the DLL (thinking it didn't even exist). These "modified" DLLs would be checked into source erroneously.
To overcome this, I interrogated the Microsoft.Common.targets file to see what the MSBuild team was doing. (This file sits in [Windows]\Microsoft.NET\Framework\v2.0.50727) To truly override the output directory, I'm using the IntermediateOutputPath and BaseIntermediateOutputPath properties. My MSBuild looks something like this:
In our case, our compiled DLLs reside in a separate directory named /build. Thus, with MSBuild writing DLLs into the /obj/Debug directory, it would always rebuild the DLL (thinking it didn't even exist). These "modified" DLLs would be checked into source erroneously.
To overcome this, I interrogated the Microsoft.Common.targets file to see what the MSBuild team was doing. (This file sits in [Windows]\Microsoft.NET\Framework\v2.0.50727) To truly override the output directory, I'm using the IntermediateOutputPath and BaseIntermediateOutputPath properties. My MSBuild looks something like this:
Comments