Skip to content
Permalink
Browse files

[Templates] Patching of TargetFramework section is now forcing netsta…

…ndard2.0
  • Loading branch information
xen2 committed Dec 21, 2018
1 parent b5f8ea2 commit e45f1721b3a202463ef821308ebf5221db079ad2
@@ -1,19 +1,2 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<#
var targetFrameworks = ((IEnumerable<dynamic>)Properties.Platforms).Select(x => x.TargetFramework).Distinct().ToList();
if (targetFrameworks.Count > 1) { #>
<TargetFrameworks><#= string.Join(";", targetFrameworks) #></TargetFrameworks>
<# } else { #>
<TargetFramework><#= targetFrameworks[0] #></TargetFramework>
<# }
var runtimeIdentifiersByTargetFramework = ((IEnumerable<dynamic>)Properties.Platforms).Where(x => x.RuntimeIdentifier != null).GroupBy(x => (string)x.TargetFramework, x => (string)x.RuntimeIdentifier).ToList();
foreach (var runtimeIdentifiers in runtimeIdentifiersByTargetFramework)
{
if (runtimeIdentifiers.Count() > 1) {
// We will need MSBuild.Sdk.Extras for that: https://github.com/onovotny/MSBuildSdkExtras
throw new System.NotSupportedException(string.Format("Target framework {0} has multiple runtime identifiers ({1})", runtimeIdentifiers.Key, string.Join(";", runtimeIdentifiers)));
}
else if (runtimeIdentifiers.Count() == 1) { #>
<RuntimeIdentifier Condition="'$(TargetFramework)' == '<#=runtimeIdentifiers.Key#>'"><#= runtimeIdentifiers.First() #></RuntimeIdentifier>
<# }
} #>
<TargetFramework>netstandard2.0</TargetFramework>

0 comments on commit e45f172

Please sign in to comment.
You can’t perform that action at this time.