No longer add runtime identifier when migrating apps that contain full framework and no runtime identifiers already.

This commit is contained in:
Livar Cunha 2017-02-17 11:30:20 -08:00
parent d4c8220297
commit b8a68ad2e0
2 changed files with 5 additions and 73 deletions

View file

@ -50,15 +50,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
propertyGroup,
mergeExisting: true);
}
_transformApplicator.Execute(
RuntimeIdentifiersTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
_transformApplicator.Execute(
RuntimeIdentifierTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
}
private void CleanExistingProperties(ProjectRootElement csproj)
@ -127,36 +118,5 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
"TargetFramework",
framework => framework.GetShortFolderName(),
framework => true);
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifiersTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifiers",
projectContexts => RuntimeIdentifiers,
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasBothCoreAndFullFrameworkTFMs());
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifierTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifier",
projectContexts => "win7-x86",
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasFullFrameworkTFM())
.WithMSBuildCondition(projectContexts =>
{
string msBuildCondition = null;
if (projectContexts.HasBothCoreAndFullFrameworkTFMs())
{
msBuildCondition = string.Join(
" OR ",
projectContexts.Where(p => p.IsFullFramework()).Select(
p => $"'$(TargetFramework)' == '{p.TargetFramework.GetShortFolderName()}'"));
msBuildCondition = $" {msBuildCondition} ";
}
return msBuildCondition;
});
}
}