Build/Test Issues

NCrunch refuses to run when dependent project uses .NET Standard and a test library

Started by ClausAppel3Shape on 1,927 views

Hi!

I had NCrunch running until recently. Then I deleted a bunch of local settings, and apparently I lost some NCrunch settings that were not checked into source control. Now NCrunch no longer runs in the given code base.

I get a number of warnings like this:

MSB3243: No way to resolve conflict between "FsCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" and "FsCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<something-non-null>". Choosing "FsCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.

... and a few more NuGets like this. I believe this is because I use the StrongNamer package to auto-generate strong names for NuGets that are not signed.

I believe this is fixable with the right NCrunch settings (since it worked yesterday), but I don't know which settings. Can anyone help?

Thanks in advance!


EDIT: I found out that the above is apparently not the real problem. The problem appears to be this:

* I have a test project, P1. It targets .NET Core 3.1.
* Test project P1 depends on test helper project P2. P2 does not contain tests, but it does have a reference to a test framework (Xunit).
* P2 targets .NET Standard 2.0.

Now NCrunch becomes sad. It marks P2 as "failed" because it can't run its tests (even though there are no tests in it), and hence NCrunch also refuses to run tests in other projects that depend on P2.

Workaround: Change P2 to dual-target .NET Standard 2.0 and .NET Core 3.1.

Is there a better way to fix this? Or can it be considered a bug in NCrunch?

Edited

Hi, thanks for sharing this issue.

When NCrunch detects your netstandard project as referencing Xunit, it considers it a test project. The easy solution here would be to go into your NCrunch configuration for this project and disable the Xunit adapter for the project. This will stop NCrunch from trying to discover tests in the project and prevent downstream issues.
Remco wrote:Hi, thanks for sharing this issue.

When NCrunch detects your netstandard project as referencing Xunit, it considers it a test project. The easy solution here would be to go into your NCrunch configuration for this project and disable the Xunit adapter for the project. This will stop NCrunch from trying to discover tests in the project and prevent downstream issues.

Thanks! Setting "XUnit v2+ Enabled" to false for these helper projects seems to resolve it. :)

Post a reply

Log in to reply.