Build/Test Issues

CopyReferencedAssembliesToWorkSpace when false still uses workspace and not output folder.

Started by BookSwapSteve on 6,712 views

Hi,

My tests require xml files local to the executing assembly, I've set CopyReferencedAssembliesToWorkspace as false for all my projects, however NCrunch appears to be running the assembly in a temp folder, so the xml files are not getting picked up. I would expect/hope this was the same as ShadowCopy, which I have disabled.

Exception: FileNotFoundException. Could not find file c:\users\<username>\AppData\Local\NCrunch\10624\66\<ProjectFolder>\bin\debug\SampleData\<file>.xml

Is this by design? Or do I need to embed my xml files?

Cheers,

Steve.
Hi Steve,

NCrunch moves the files within your project over to a workspace where they can then be built and have their tests executed.

In order to copy the files, it needs to know which files to copy. It looks to me like the .xml file you are expecting is not referenced within your .proj file, or perhaps its referenced in a manner that NCrunch doesn't understand.

The easiest way to solve this problem is to add a relative reference to the file using the AdditionalFilesToInclude configuration option on the offending project. In this way, NCrunch will know about the file and will be able to copy it to the workspace.


Cheers,

Remco
Hi,

I discovered the Additional Files option shortly after posting, I'll check that out another day, for now I've just ignored the test fixture.

The files are referenced by the project and set to Copy Always, I don't know if that's something you can pick up on and automate, or just a case of learning how the tool works.

Thanks,

Steve.
It often helps to have a browse around the workspace NCrunch has built to see if the file exists in the place you would expect it to. You can do this by right-clicking on a project in the tests window, then choosing to browse to the workspace. If there are files required by your tests that are missing from the workspace but they exist in your solution path, then the additional files to include setting may prove a solution to this.

Also ensure that your test is referencing the xml file using the correct path - it should be a relative reference identical to that used in your solution outside the workspace.

Post a reply

Log in to reply.