System.ArgumentException: Unknown framework version 7.0
See original GitHub issueHello, I’m getting System.ArgumentException: Unknown framework version 7.0 when trying to use nunit on .net framework project:
PS D:\devdiv\vscodecoverage> dotnet --version
7.0.100-preview.4.22252.9
PS D:\devdiv\vscodecoverage> dotnet test .\artifacts\bin\Microsoft.CodeCoverage.Console.Common.Tests\Release\net48\Microsoft.CodeCoverage.Console.Common.Tests.dll
Microsoft (R) Test Execution Command Line Tool Version 17.3.0-preview-20220414-05 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Exception System.TypeInitializationException, Exception thrown executing tests in D:\devdiv\vscodecoverage\.\artifacts\bin\Microsoft.CodeCoverage.Console.Common.Tests\Release\net48\Microsoft.CodeCoverage.Console.Common.Tests.dll
The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
at NUnit.Engine.Services.RuntimeFrameworkService.ApplyImageData(TestPackage package)
at NUnit.Engine.Services.RuntimeFrameworkService.SelectRuntimeFramework(TestPackage package)
at NUnit.Engine.Runners.MasterTestRunner.GetEngineRunner()
at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Explore(TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 88
at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping`2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 275
InnerException: System.ArgumentException: Unknown framework version 7.0
Parameter name: version
at NUnit.Engine.RuntimeFramework.GetClrVersionForFramework(Version frameworkVersion)
at NUnit.Engine.RuntimeFramework..ctor(RuntimeType runtime, Version version, String profile)
at NUnit.Engine.RuntimeFramework.GetNetCoreRuntimesFromDirectoryNames(IEnumerable`1 dirNames)
at NUnit.Engine.RuntimeFramework.FindDotNetCoreFrameworks()
at NUnit.Engine.RuntimeFramework.FindAvailableFrameworks()
at NUnit.Engine.RuntimeFramework.get_AvailableFrameworks()
at NUnit.Engine.Services.RuntimeFrameworkService..cctor()
No test is available in D:\devdiv\vscodecoverage\.\artifacts\bin\Microsoft.CodeCoverage.Console.Common.Tests\Release\net48\Microsoft.CodeCoverage.Console.Common.Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Additionally, path to test adapters can be specified using /TestAdapterPath command. Example /TestAdapterPath:<pathToCustomAdapters>.
This is probably related to https://github.com/nunit/nunit-console/issues/1176 but I’m using vstest.console and adapter.
I’m using:
<NUnitVersion>3.13.3</NUnitVersion>
<NUnitTestAdapterVersion>4.2.1</NUnitTestAdapterVersion>
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:37 (27 by maintainers)
Top Results From Across the Web
Unable to run NUnit tests after upgrading to VS2022 17.4.0
ArgumentException : Unknown framework version 7.0 Parameter name: version at NUnit.Engine.RuntimeFramework.GetClrVersionForFramework(Version ...
Read more >.NET 7 - The type initializer for 'NUnit.Engine.Services. ...
InnerException: System.ArgumentException: Unknown framework version 7.0. Parameter name: version. at NUnit.Engine.RuntimeFramework.
Read more >Adapter V4 Release Notes
NUnit3 Test Adapter for Visual Studio and Dotnet - Version 4.5.0 - May 30, 2023 ... 987 System.ArgumentException: Unknown framework version 7.0.
Read more >Supported Frameworks
The table below shows the supported adapter versions for a given framework version. Framework version, Supported by Adapter versions, Comment. Net Core 1.0,...
Read more >Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Upgrade NUnit3TestAdapter to 4.3.1 and the tests should work
I think it is better to follow the advice in documentation:😃
Nunit is working fine using NUnit3TestAdapter v4.3.0 in net7 and old frameworks.