Nunit-console: NUnit Console cannot run tests with TargetFramework "net5.0"

Created on 8 Jan 2021  路  16Comments  路  Source: nunit/nunit-console

If it matters, I'm using:

  • NUnit Console Runner 3.12.0-beta1
  • NUnit: 3.13.0
  • NUnit3TestAdapter: 4.0.0-beta.1

When I compile my tests with TargetFramework "netcoreapp3.1", the console works fine.

When I compile my tests with TargetFramework "net5.0", the console cannot execute them.

This is the output:

NUnit Console Runner 3.12.0-beta1
Copyright (c) 2020 Charlie Poole, Rob Prouse
Friday, January 8, 2021 2:17:14 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19042
  Runtime: .NET Core 3.1.10

Test Files
    .\MyTests.dll


Errors, Failures and Warnings

1) Invalid : MyTests.dll
Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Run Settings
    DisposeRunners: True
    WorkDirectory: path\to\src\bin\Debug\net5.0
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-01-08 17:17:14Z
    End time: 2021-01-08 17:17:14Z
    Duration: 0.169 seconds

Looking the console output I see the runner is using "Runtime: .NET Core 3.1.10". I cannot find an option in command line to change this (maybe it is not detecting correctly yet?). I tested adding the parameter --framework=net5.0, but it outputs:
The framework= option is not available on this platform.

My questions:

  1. Is it expected? The NUnit Console Runner is not ready to .net5 yet?
  2. If it is not expected, what I'm doing wrong and what I can do to fix it?
confirm bug

Most helpful comment

FYI... the GUI now has a .NET 5.0 agent.

All 16 comments

The output displayed indicates that the console runner itself targets .net core 3.1. So too does the engine used by the runner. However, it says nothing about the process in which your tests are running.

When we build the runner, we actually run tests under .NET 5.0, if it is installed. However, it's possible that the beta-1 release is still not able to handle that. I suggest trying the latest -devpre-release on our myget feed.

@ChrisMaddock you probably have a more complete answer for this than I do.

I have updated the console with latest version in myGet 3.12.0-dev-04990, but I received the same error:

NUnit Console Runner 3.12.0-dev-04990
Copyright (c) 2020 Charlie Poole, Rob Prouse
Friday, January 8, 2021 5:19:01 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19042
  Runtime: .NET Core 3.1.10

Test Files
    .\MyTests.dll


Errors, Failures and Warnings

1) Invalid : MyTests.dll
Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Run Settings
    DisposeRunners: True
    WorkDirectory: path\to\src\bin\Debug\net5.0
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-01-08 20:19:01Z
    End time: 2021-01-08 20:19:01Z
    Duration: 0.188 seconds

AND in myGet page says in "Target frameworks" section ".NETCoreApp 3.1: 3.1.0.0", no mention to "net5.0":
myGet

Finally (don't take me wrong, I'm not being annoying, just helping on debugging).
I created the default console app with dotnet new nunit. Then I executed dotnet build. I changed to bin\Debug\net5.0 folder and executed nunit .\NUnitConsoleBug.dll and the same error happens:

NUnit Console Runner 3.12.0-dev-04990
Copyright (c) 2020 Charlie Poole, Rob Prouse
Friday, January 8, 2021 6:05:36 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19042
  Runtime: .NET Core 3.1.10

Test Files
    .\NUnitConsoleBug.dll


Errors, Failures and Warnings

1) Invalid : C:/NUnitConsoleBug/bin/Debug/net5.0/NUnitConsoleBug.dll
Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Run Settings
    DisposeRunners: True
    WorkDirectory: C:\NUnitConsoleBug\bin\Debug\net5.0
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-01-08 21:05:36Z
    End time: 2021-01-08 21:05:37Z
    Duration: 0.236 seconds

Results (nunit3) saved as TestResult.xml

Anyway, if it can help, this is the content of the auto generated project file, targeting .net5:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NUnit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
  </ItemGroup>

</Project>

Yeah, I noticed the NUnit 3.12.0 version. I updated to 3.13, and NUnit3TestAdapter to 4.0.0-beta.1 but it does not work too.

And guess what happens when I change the TargetFramework in project file to netcoreapp3.1?

NUnit Console Runner 3.12.0-dev-04990
Copyright (c) 2020 Charlie Poole, Rob Prouse
Friday, January 8, 2021 6:30:58 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19042
  Runtime: .NET Core 3.1.10

Test Files
    .\NUnitConsoleBug.dll


Run Settings
    DisposeRunners: True
    WorkDirectory: C:\NUnitConsoleBug\bin\Debug\netcoreapp3.1
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Passed
  Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-01-08 21:30:58Z
    End time: 2021-01-08 21:30:59Z
    Duration: 0.412 seconds

If @ChrisMaddock, who wrote the .NET Core runner, jumps in here, you can just ignore me, since I'm focused on other areas. But here's what seems to be happening.

  1. There __is no__ .NET 5.0 NUnit runner or engine, as I indicated earlier.
  2. If you had __only__ .NET 5.0 installed, I suspect what you are doing would work because our 3.1 runner would execute under .NET 5.0 without any other option.
  3. You appear to have .NET Core 3.1 installed. (Right?) Consequently, dotnet selects that runtime to execute the runner, since the runner targets it.
  4. You have to tell dotnet (not the console) that you want to run under .NET 5.0.
  5. This is done using the dotnet command option -fx-version option.

Hope that's clear. I'm about 90% sure it's right :confused: because what you are doing is not __exactly__ what we do in our own tests. We don't yet have a 5.0 build, so we are running 3.1 tests __under__ 5.0. IOW, YMMV. :smile:

Hey @CharliePoole, it works now! 馃槃

My problem was, I'm calling directly nunit3-console.exe or nunit (the global dotnet cli tool) in command line. With your tip about --fx-version (which appear works only using dotnet command directly), I executed this command:

dotnet --fx-version 5.0.1 "C:\Users\{Windows User}\.nuget\packages\nunit.consolerunner.netcore\3.12.0-dev-04990\tools\netcoreapp3.1\any\nunit3-console.dll" .\NUnitConsoleBug.dll

and the result is:

NUnit Console Runner 3.12.0-dev-04990
Copyright (c) 2020 Charlie Poole, Rob Prouse
Friday, January 8, 2021 7:43:04 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19042
  Runtime: .NET 5.0.1-servicing.20575.16

Test Files
    .\NUnitConsoleBug.dll


Run Settings
    DisposeRunners: True
    WorkDirectory: C:\NUnitConsoleBug\bin\Debug\net5.0
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Passed
  Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2021-01-08 22:43:04Z
    End time: 2021-01-08 22:43:04Z
    Duration: 0.201 seconds

It correctly detected net5.0...

I think I can use it like this, but is this (or will be) the correct way to execute it from now on?

As you saw, there are currently two runners, one for .NET Framework and another for .NET Core. I initially thought you might be using the wrong one, but you talked about running the dotnet command, so I figured you were not.

Having two runners is probably not a long term solution, because some folks will want to run projects that include both framework and core test assemblies. However, it's where we are right now.

If you want to try using a GUI, I invite you to look at my TestCentric GUI, which takes the approach of a single runner with multiple agents. Unfortunately, I haven't yet published a .NET 5.0 agent.

Both projects are looking at decoupling agents from the engine in the future, so they become pluggable.

This TestCentric GUI is amazing, but "unfortunatelly" 馃槃 you help me on fix my issue so my tests will be compiled and executed in .Net 5 now, and then this tool is obsolete for me. But really I will wait (or maybe help) on building your .Net 5 agent.

Cute! Actually, creating a .net 5 agent is relatively trivial and has potential for wide benefits. I'll add an issue.

FYI... the GUI now has a .NET 5.0 agent.

I would like to point out that the suggested --fx-version parameter is only usable if you do not use the console runner directly. In our environment, we use unit tests via dotCover to measure code coverage too. So if I have

dotCover.exe cover /TargetWorkingDir=.\ /TargetExecutable="c:\Program Files\dotnet\dotnet.exe" /TargetArguments="test --logger trx;LogFileName=DotnetTestResults.xml" /Output=TestCoverageDotcover.xml /ReportType=XML

Then it works fine, I have a nice test output and a test coverage output as well because "dotnet test" will use the appropriate runtime, as it is shown during the execution: "Test run for c:\xxx\CarShop.Testsbin\Debug\net5.0\CarShop.Tests.dll (.NETCoreApp,Version=v5.0)"

However, if I want to use the console runner directly, it does not work:

dotCover.exe cover /TargetWorkingDir=.\ /TargetExecutable="c:\xxx\nunit3-console.exe" /TargetArguments="\"c:\xxx\bin\Debug\net5.0\CarShop.Tests.dll\" --noc --skipnontestassemblies" /Output=TestCoverageDotcover.xml /ReportType=XML

In the second case, I cannot set the runtime version, nunit3-console will say: "Invalid argument: --fx-version"... As a result, I have failure:

Runtime Environment
   OS Version: Microsoft Windows 10.0.17763
  Runtime: .NET Core 3.1.11

Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  ----> Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

In september we managed to switch to dotnet core with the test runners as you released the "NUnit Console and Engine 3.12.0 Beta 1" on 1/Aug. First of all, I'd like to say I am very thankful for that :) But now we'd like to switch to .net5.0 in February, but the standalone console runner does not work as expected...

Using "dotnet test" is a good workaround. And also, the .net5 tests are executed nicely with the latest TestCentricGui ZIP package ... So a question to @CharliePoole : what is the future plan with the runners?

1) will you extend nunit3-runner with an --fx-version or implement some auto detection?
2) will you extend TestCentricGui with some commandline switches to "execute tests, generate XML, then exit"?
3) shall I forget the nUnit console runner, and just use "dotnet test" ?

(+1: btw, are there any advantages for the console runner over "dotnet test"? I see the XML report format is different, but is there any differences functionality-wise???)

ps> Thank you for your project!!!

@anoftc First off, I can only try to answer questions about what NUnit3 Console now does. I'm not the guy to tell you what the plans are.

As far as your two command examples go, they are not comparable. The first doesn't run the console runner at all while the second does. In the second command, you have to pass the fx--version option to dotnet.exe, not to NUnit. You'll have to experiment to get the right ordering of options. Worst case, you may need to have two layers of dotnet.exe, one for cover and one for nunit. The second layer should use a run argument, not a test argument. (That said, I haven't tried this myself)

WRT your questions...

  1. Sorry, I'm not the guy to tell you what the console runner __will do__ in the future. I'll leave that to @ChrisMaddock .

  2. The GUI can already do that. Ask on the GUI project for specifics, please.

  3. Personally, I don't think so. I use the console runner for all my command-line dotnet work. I just use dotnet run rather than dotnet test. Usually, it's all wrapped in a script anyway.

To your BTW question: Mainly, dotnet test relies on vstest, which has a general picture of tests that doesn't match NUnit's so well. For example, it doesn't know about warnings, inconclusive results, theories, explicit tests... so you have to know not to use any of those features when you use that runner. Not a criticism of the product, just a fact of life whenever you go through an adapter layer between two pieces of software, especially a generalized layer.

Charlie

@anoftc, this explanation from @CharliePoole is exactly what is happening with me.

  • Instead of detect the test dll version, the nunit3-console.exe uses .NET Core 3.1.10 instead of .Net 5;
  • I cannot use dotnet test because is very limited compared with nunit3-console.exe;
  • I call then dotnet to execute the nunit3-console.dll and as parameter I pass my test dll and other nunit parameters. The final command is something like this:
    dotnet --fx-version 5.0.1 "C:\path\to\nunit3-console.dll" C:\path\to\MyDotNet5Tests.dll

It works but it has disadvantages too. I successfully deployed to a "mcr.microsoft.com/dotnet/aspnet:5.0" container. Yesterday the code stopped to work in my computer. Guess what? I updated the Visual Studio version and it updated my .Net5 to 5.0.2, and how this code expects 5.0.1 it does not works anymore in my PC. And the worse part, --fx-version does not accept something like "5.0.*", so I will need revert (if possible) the version in my PC to match the server container or parametrize this, providing the correct framework version depending of the environment.

Or maybe nunit3-console.exe will be updated to deal with all this situation, what comes first 馃槃.

I ran into this problem when updating our large WPF application to net5.0.
I was able fix the initial problem (could not load System.Runtime) by using latest myget build of NUnit.ConsoleRunner.NetCore and the "dotnet --fx-version ...." command described above.
Now I am facing a very similar problem:
1) Invalid : C:/WORK/desktop_master/src/motioncatalyst/BUILD/Tests_AnyCPU_Release/SwingCatalyst.Test.Unit.dll Unable to load one or more of the requested types. Could not load file or assembly 'WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load file or assembly 'PresentationFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. ----> Could not load file or assembly 'WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. ----> Could not load file or assembly 'PresentationFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

Is this related to our test project targeting net5.0-windows instead of just plain net5.0?
Is there some way to configure the dotnet command to "run as net5.0-windows"?

@rprouse To me it seems like this is a blocking issue for using the nunit console runner with net5/net6.
Is there a plan for how this is supposed to work?
Should we transition away from using nunit and/or transition away from using the nunit console runner, if we want to upgrade to net5 and net6?

I think we need @ChrisMaddock's opinion on this since he did most of the work on the .NET Core version of the runner. I admit that the last minute changes in .NET 5 caught us off guard.

Until we get this fixed in the console runner, have you tried adding the NUnit VS Test Adapter to your projects and running using VSTest or dotnet test?

Was this page helpful?
0 / 5 - 0 ratings