in src/Tasks/Microsoft.NET.Build.Tasks/WriteAppConfigWithSupportedRuntime.cs [90:144]
private static bool TryGetSupportRuntimeNode(
string targetFrameworkIdentifier,
string targetFrameworkVersion,
string targetFrameworkProfile,
string runtimeVersion,
out XElement supportedRuntime)
{
supportedRuntime = null;
if (targetFrameworkIdentifier == ".NETFramework"
&& Version.TryParse(targetFrameworkVersion.TrimStart('v', 'V'), out Version parsedVersion))
{
if (parsedVersion.Major < 4)
{
string supportedRuntimeVersion = null;
if (parsedVersion.Major == 1 && parsedVersion.Minor >= 0 && parsedVersion.Minor > 1)
{
supportedRuntimeVersion = "v1.0.3705";
}
else if (parsedVersion.Major == 1 && parsedVersion.Minor >= 1)
{
supportedRuntimeVersion = "v1.1.4322";
}
else if (parsedVersion.Major >= 2 && parsedVersion.Major < 4)
{
supportedRuntimeVersion = "v2.0.50727";
}
if (supportedRuntimeVersion == null)
{
return false;
}
supportedRuntime =
new XElement(
"supportedRuntime",
new XAttribute("version", supportedRuntimeVersion));
return true;
}
else if (parsedVersion.Major == 4)
{
string profileInSku = targetFrameworkProfile != null ? $",Profile={targetFrameworkProfile}" : string.Empty;
supportedRuntime =
new XElement(
"supportedRuntime",
new XAttribute("version", "v4.0"),
new XAttribute("sku", $"{targetFrameworkIdentifier},Version={targetFrameworkVersion}{profileInSku}"));
return true;
}
}
return false;
}