Skip to content

Commit

Permalink
Fix exception thrown for .NET Standard assemblies... again!
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Jun 12, 2024
1 parent 2823733 commit 69a9490
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cake/package-tests.cake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static PackageTest Net60Test = new PackageTest(
static PackageTest Net60X86Test = new PackageTest(
"Net60X86Test",
"Run mock-assembly-x86.dll under .NET 6.0",
"net6.0/mock-assembly-x86.dll --trace:Debug",
"net6.0/mock-assembly-x86.dll",
MockAssemblyExpectedResult(1));

static PackageTest Net50Test = new PackageTest(
Expand Down
10 changes: 7 additions & 3 deletions src/NUnitEngine/nunit.engine/Services/RuntimeFrameworkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private RuntimeFramework SelectRuntimeFrameworkInner(TestPackage package)

if (string.IsNullOrEmpty(imageTargetFrameworkNameSetting))
{
// Assume .NET Framework
// Assume .NET Framework 2.0
targetRuntime = currentFramework.Runtime;
targetVersion = package.GetSetting(InternalEnginePackageSettings.ImageRuntimeVersion, new Version(2, 0));
}
Expand All @@ -152,15 +152,19 @@ private RuntimeFramework SelectRuntimeFrameworkInner(TestPackage package)
{
case ".NETFramework":
targetRuntime = RuntimeType.Net;
targetVersion = frameworkName.Version;
break;
case ".NETCoreApp":
targetRuntime = RuntimeType.NetCore;
targetVersion = frameworkName.Version;
break;
case ".NETStandard":
targetRuntime = RuntimeType.NetCore;
targetVersion = new Version(3, 1);
break;
default:
throw new NUnitEngineException("Unsupported Target Framework: " + imageTargetFrameworkNameSetting);
}

targetVersion = frameworkName.Version;
}

if (!IsAvailable(new RuntimeFramework(targetRuntime, targetVersion).Id, runAsX86))
Expand Down

0 comments on commit 69a9490

Please sign in to comment.