Exemplo n.º 1
0
        public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var csproj        = migrationRuleInputs.OutputMSBuildProject;
            var propertyGroup = migrationRuleInputs.CommonPropertyGroup;

            CleanExistingProperties(csproj);
            CleanExistingPackageReferences(csproj);

            if (migrationRuleInputs.IsMultiTFM)
            {
                _transformApplicator.Execute(
                    FrameworksTransform.Transform(
                        migrationRuleInputs.ProjectContexts.Select(p => p.TargetFramework)),
                    propertyGroup,
                    mergeExisting: true);
            }
            else
            {
                _transformApplicator.Execute(
                    FrameworkTransform.Transform(
                        migrationRuleInputs.ProjectContexts.Single().TargetFramework),
                    propertyGroup,
                    mergeExisting: true);
            }
        }
Exemplo n.º 2
0
        public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var csproj        = migrationRuleInputs.OutputMSBuildProject;
            var propertyGroup = migrationRuleInputs.CommonPropertyGroup;

            CleanExistingProperties(csproj);

            if (migrationRuleInputs.ProjectContexts.Count() > 1)
            {
                _transformApplicator.Execute(
                    FrameworksTransform.Transform(migrationRuleInputs.ProjectContexts.Select(p => p.TargetFramework)),
                    propertyGroup);
            }

            foreach (var transform in _transforms)
            {
                _transformApplicator.Execute(
                    transform.Transform(migrationRuleInputs.DefaultProjectContext.TargetFramework),
                    propertyGroup);
            }
        }
Exemplo n.º 3
0
        public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var csproj        = migrationRuleInputs.OutputMSBuildProject;
            var propertyGroup = migrationRuleInputs.CommonPropertyGroup;

            CleanExistingProperties(csproj);
            CleanExistingPackageReferences(csproj);

            if (migrationRuleInputs.ProjectContexts.Count() == 1)
            {
                _transformApplicator.Execute(
                    FrameworkTransform.Transform(
                        migrationRuleInputs.ProjectContexts.Single().TargetFramework),
                    propertyGroup,
                    mergeExisting: true);
                _transformApplicator.Execute(
                    FrameworkRuntimeIdentifiersTransform.Transform(
                        migrationRuleInputs.ProjectContexts.Single()),
                    propertyGroup,
                    mergeExisting: true);
            }
            else
            {
                _transformApplicator.Execute(
                    FrameworksTransform.Transform(
                        migrationRuleInputs.ProjectContexts.Select(p => p.TargetFramework)),
                    propertyGroup,
                    mergeExisting: true);


                var runtimes = string.Join(",", migrationRuleInputs.ProjectContexts.Select(p => p.RuntimeIdentifier));
                Console.WriteLine($"Runtimes = {runtimes}");

                _transformApplicator.Execute(
                    FrameworksRuntimeIdentifiersTransform.Transform(
                        migrationRuleInputs.ProjectContexts),
                    propertyGroup,
                    mergeExisting: true);
            }
        }