Build/Test Issues

Unable to include other project XML documentation

Started by michaellogutov on 4,709 views

In my solution I have project A then references project B.
Project B generates comments XML file (B.xml).
Project A depends on that B.xml file and there is a check in code that ensures that this files present.

Not we have test project A.Tests that referencing A and tests the code which checks the existence of XML file.
If I run this test from withing Visual Studio runner it builds A.Tests, builds A, builds B and in A.Tests bin directory there are files: A.dll, B.dll, B.xml
All works fine - test passes.

Now when I'm using nCrunch I can't seems to find a way to include B.xml for it to be in the bin directory of A.Tests
I've added project B as implicit project dependencies for project A.Tests and added "..\B\bin\Debug\B.xml" as additional file for project A.Tests - I see it in the ncrunch work folder but it not copied to bin with A.Tests.dll

What should I do?
Hi, thanks for posting!

This is technically a resource co-location assumption - see http://www.ncrunch.net/documentation/considerations-and-constraints_assembly-colocation-assumptions.

Using the 'Copy referenced assemblies to workspace' setting likely won't work here if the B.xml file is generated with a custom build step, as there is nothing telling NCrunch that it should be copied to the build output directories of referencing projects.

Adding B.xml as an additional file also won't work well, as this creates a dependency that exists outside your build system, making NCrunch dependent on your foreground build (which you really don't want).

There are two effective ways to solve this:
1. Engineer the test to copy B.xml from the build output directory of project A into the build output directory of project B.
2. Introduce an abstraction that allows your test to control how the B.xml file is resolved, so that it can override this logic and load the file from an alternative location.
Actually this is an XML comments file it's generated as part of the build.
So setting "Copy referenced assemblies to workspace" to true fixed the problem :)

I've totally overlooked that setting.

Thanks!

Post a reply

Log in to reply.