Browse Source

Enable detection of .NET version without TargetFrameworkAttribute (#3580)

pull/3583/head
Jeremy Pritts 3 months ago committed by GitHub
parent
commit
b50f4e1d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs

18
ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs

@ -100,16 +100,24 @@ namespace ICSharpCode.Decompiler.Metadata @@ -100,16 +100,24 @@ namespace ICSharpCode.Decompiler.Metadata
// 4.2.0 => .NET Core 2.0
// 4.2.1 => .NET Core 2.1 / 3.0
// 4.2.2 => .NET Core 3.1
// 5.0.0+ => .NET 5+
if (r.Version >= new Version(4, 2, 0))
{
version = "2.0";
if (r.Version >= new Version(4, 2, 1))
if (r.Version.Major >= 5)
{
version = "3.0";
version = r.Version.ToString(2);
}
if (r.Version >= new Version(4, 2, 2))
else if (r.Version.Major == 4 && r.Version.Minor == 2)
{
version = "3.1";
version = r.Version.Build switch {
<= 0 => "2.0",
1 => "3.0",
_ => "3.1"
};
}
else
{
version = "2.0";
}
return $".NETCoreApp,Version=v{version}";
}

Loading…
Cancel
Save