I used to have a Tests folders in my main project where a unit test had this line of code:
Foo foo = new Foo(Environment.CurrentDirectory + @'\XML\FooData.xml' );
I have an XML directory in the Foo project that has a FooData.xml
In the post build event of my projects i have the following line copy ‘$(ProjectDir)Foo\Currencies.xml’ ‘$(TargetDir)\XML’
I now have broke all unit tests into another projects to separate them out and i now get the following error when running these unit tests.
Could not find a part of the path ‘C:\svncheckout\Foo.Tests\bin\Debug\XML\FooData.xml’
Rather than having a post-build step, can you not just make it a ‘content’ item in Visual Studio, telling it to copy it to the target directory? I usually either do that, or make it an embedded resource and use streams and Assembly.GetManifestResourceStream.