I ran into this NCrunch bug (or at least difference from VS build):
1. Create a class library ClassLibrary1 and a unit test project UnitTestProject1, with UnitTestProject1 referencing ClassLibrary1.
2. Create a folder "Targets" as a sibling to ClassLibrary1/UnitTestProject1 folders, and call it "Targets". Add a myTargets.targets file that has this:
Code:
<Project xmlns="(- BROKEN LINK -)">
<ItemGroup Condition="'$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')">
<Content Include="$(MSBuildThisFileDirectory)\foo.txt">
<Link>%(FileName).txt</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
3. Add a file "foo.txt" in the Targets folder.
4. Add this line to ClassLibrary1.csproj:
<Import Project="..\Targets\MyTargets.targets" />
Now, when you build the project, foo.txt will be copied to the /bin/Debug folder of both ClassLibrary1 and UnitTestProject1.
However, if you navigate to the NCrunch workspace for UnitTestProject1, foo.txt is not there. (They are there for ClassLibrary1 though). Interestingly, it's not there for UnitTestProject1 even after you add foo.txt and MyTargets.targets to "Additional files to include".
In my case, the import was added via a NuGet package. The workaround for me was easy, just add the same NuGet to package to the unit test project. However, I expected it to just work.