Warning! Hard geeky stuff ahead. I think even I will not understand what I wanted to write after few days…
I have .NET solution with multiple projects and multiple unit test projects. All unit test project share the same configuration and I don’t want to maintain multiple config files.
So I finally whipped myself together this nice little “relative” post build event that copies UnitTest.config from the parent (solution directory) in output directories of unit test projects and renames the file accordingly.
It wouldn’t be a big deal if NAnt would have different working directory than VS when running post build events. So it’s essential to use post build macros! And with using macros this can be the same accross multiple projects.
xcopy $(SolutionDir)UnitTest.config $(ProjectDir)$(OutDir) /Y
ren $(ProjectDir)$(OutDir)UnitTest.config $(TargetFileName).config