dotnet-test-nunit
dotnet-test-nunit copied to clipboard
nunit3-console doesn't work with .NET versions past 4.5
nunit3-console.exe MyTestAssembly.dll /framework:net-4.7 /work:TestResults
Results in:
The requested framework net-4.7 is unknown or not available.
The same results for net-4.5.2, net-4.6, net-4.6.2 Only net-4.5 works
While your statement is correct, I'm not 100% sure what we should do about it. We might want to add other options to those four that are supported or it may simply be a matter of documentation.
The /framework
option is used when you want an assembly built to target a particular runtime to run under a different runtime. Is that the case in your usage?
I assume that your test is referencing the net-4.5 build of the NUnit framework, which is compatible with the higher-level runtimes you list.
@CharliePoole,
- I think that it should be documented, at least.
- They are not entirely compatible, the framework libraries are different. Running the tests in a different environment can result in false positives or false negatives.
Can you clarify point 2? Is there something that doesn't work when you run the tests normally without the /framework
option?
We don't build the framework for a higher level that 4.5 because we don't make use of any features beyond those that 4.5 supports. Our four builds (2.0, 3.5, 4.0 and 4.5) have some slight differences, but we have not found any need to add further builds so far. Your tests should run automatically under the 4.7 framework, if that's what you targeted, unless you specify a /framework
option.
@CharliePoole, just theoritizing :)
One possible problematic place is GCSettings.LargeObjectHeapCompactionMode added in 4.5.2, but I haven't had any problems so far.
Your tests should run automatically under the 4.7 framework, if that's what you targeted, unless you specify a /framework option.
How does it detect it?
On documentation... we currently only say "Examples: mono, net-4.5, v4.0, 2.0, mono-4.0" which doesn't tell you exactly what is supported and what isn't. We should at a minimum provide a complete list of what is accepted. Ideally, we should accept through 4.7 and act on it.
@fandrei Since that's not a feature we use in NUnit, we would not need to build to the 4.7 framework because of it. Your code, of course, can take advantage of it, while still referencing libraries built to target the 4.5 runtime - or even 2.0 for that matter.
We determine the target runtime by examining the TargetFrameworkAttribute. The process launched to run your tests should be running under that runtime. If you see it isn't, of course, then we have an additional bug.
@CharliePoole, it seems that everything's fine. The only problem is documentation. And the error message is a bit misleading. Thanks for your help.