Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch test fails to find an output file from a reference project
Dirk Maegh
#1 Posted : Wednesday, March 24, 2021 10:18:45 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 48
Location: Belgium

Thanks: 6 times
Was thanked: 7 time(s) in 7 post(s)
Hi,

Today I ran into a unittest that ncrunch reported as failed on my machine.
I did not touch it and inspected the test runs in the cloud pipelines - they also did not fail.
So I investigated further, and ran the same test in Resharper unit test runner, it ran fine.
I investigated further. Running the same test by VS 2019 (latest version) Test Explorer also runs fine.

What failed on my machine was reading a xslt file, that lives in a referenced project - it has build action None, and Copy Always.
I noticed that my unittest project build output effectively contains the same file.
When I inspect the Resharper output directory, it contains the same files.
When I inspect the NCrunch output directory, it does not contain this file (nor a lot of other files), so maybe it makes sense that the file cannot be read when run by ncrunch.

Is this something you could fix please ?
Remco
#2 Posted : Wednesday, March 24, 2021 10:55:46 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,968

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for posting.

To allow NCrunch to work with this structure, you need to turn on the copy referenced assemblies to workspace setting for the referencing project. This will tell NCrunch to make sure that the files in the build output directory of the referenced project are copied over when the referencing project is build.

There is a cost to using this setting, which is why it isn't enabled by default. Where possible, I would recommend you engineer your code in such a way that the setting isn't required. For example, if you have control over the search logic for the XSLT, perhaps try to find this file based on the assembly location of the project that contains it (i.e. GetType().Assembly.Location).
1 user thanked Remco for this useful post.
Dirk Maegh on 3/25/2021(UTC)
Dirk Maegh
#3 Posted : Thursday, March 25, 2021 10:05:16 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 48
Location: Belgium

Thanks: 6 times
Was thanked: 7 time(s) in 7 post(s)
Thanks for your answer. It indeed fixed it straight away, simple and un-painfully ;)

Problem that I think is submerging here, is this feature is not obvious. I know it now, but in three months time, I will have forgotten about it, and the same question will rise again somewhere else.
But a question here fixes it real quick. Thanks again :)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download