0

In our solution, we have three relevant projects to this issue. Below is a diagram that displays them:

dependency diagram

Project A runs tests on C, which implements the Flee nuget package. This package apparently supports both .NET Framework and .NET Core. When I examine the contents of the package directory in my local nuget cache, it has two different dlls: Flee.Net45.dll and Flee.Standard20.dll.

The problem is that when running the tests in A, the following error occurs for all tests relating to C:

System.IO.FileNotFoundException:
Could not load file or assembly Flee.NetStandard20, [...] The system cannot find the file specified.

The first thing I did was check the bin folder: that's when I see that the Flee.Net45.dll sitting there. Which seems to be correct, since the project A is using .NET Framework. In the csproj file for project A, the framework is set as: <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>.

To troubleshoot further, I set up a temporary xUnit Test Project (.NET Core) (that's project B), and copied the relevant tests across. They all passed - and in the bin folder, it showed Flee.NetStandard20.dll, which is what I expected.

Question

When I run the tests in a project that targets .NET Framework, why is it looking for Flee.Standard20.dll at runtime? Does this look like an issue with the Flee package? Or would it be a configuration issue in project A?

Mike Baxter
  • 6,868
  • 17
  • 67
  • 115
  • Sounds like a .NET bug to me more than anything. What's the behaviour if your test project targets net45? – rbennett485 Feb 24 '21 at 16:58
  • Unfortunately I can't test that, as visual studio informs me that a `.NET Framework 4.5` project cannot reference a `.NET Standard 2.0` one. – Mike Baxter Feb 24 '21 at 17:05
  • was just going to say that won't work, it's only for net461 plus. I bet this is a bug around that – rbennett485 Feb 24 '21 at 17:07

0 Answers0