question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.ArgumentException: Unknown framework version 7.0

See original GitHub issue

Hello, 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:37 (27 by maintainers)

github_iconTop GitHub Comments

2reactions
bxm185commented, Nov 30, 2022

Upgrade NUnit3TestAdapter to 4.3.1 and the tests should work

2reactions
moh-hassancommented, Nov 14, 2022

I think it is better to follow the advice in documentation:😃

The NUnit3TestAdapter is the best place to start.

Nunit is working fine using NUnit3TestAdapter v4.3.0 in net7 and old frameworks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found