Skip to content

Commit

Permalink
Fix icsharpcode#2469: Add special case for mscorlib and netstandard.d…
Browse files Browse the repository at this point in the history
…ll to DetectTargetFrameworkId
  • Loading branch information
siegfriedpammer committed Nov 14, 2021
1 parent dfd4640 commit 8f6ee05
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public static string DetectTargetFrameworkId(this PEReader assembly, string asse
}
}

var thisAssemblyName = reader.GetAssemblyDefinition().GetAssemblyName();
switch (thisAssemblyName.Name)
{
case "mscorlib":
return $".NETFramework,Version=v{thisAssemblyName.Version.ToString(2)}";
case "netstandard":
return $".NETStandard,Version=v{thisAssemblyName.Version.ToString(2)}";
}

foreach (var h in reader.AssemblyReferences)
{
try
Expand All @@ -83,7 +92,7 @@ public static string DetectTargetFrameworkId(this PEReader assembly, string asse
switch (reader.GetString(r.Name))
{
case "netstandard":
version = r.Version.ToString(3);
version = r.Version.ToString(2);
return $".NETStandard,Version=v{version}";
case "System.Runtime":
// System.Runtime.dll uses the following scheme:
Expand Down

0 comments on commit 8f6ee05

Please sign in to comment.