Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Templates] Patching of TargetFramework section is now forcing netsta…
…ndard2.0
  • Loading branch information
xen2 committed Jan 10, 2019
1 parent b5f8ea2 commit e45f172
Showing 1 changed file with 1 addition and 18 deletions.
@@ -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.