public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var projectContext           = migrationRuleInputs.DefaultProjectContext;
            var raw                      = projectContext.ProjectFile.RawRuntimeOptions;
            var outputRuntimeOptionsFile = Path.Combine(migrationSettings.OutputDirectory, s_runtimeOptionsFileName);

            if (!string.IsNullOrEmpty(raw))
            {
                if (File.Exists(outputRuntimeOptionsFile))
                {
                    MigrationErrorCodes.MIGRATE1015(
                        String.Format(LocalizableStrings.ProjAlreadyExistsError, outputRuntimeOptionsFile)).Throw();
                }

                File.WriteAllText(outputRuntimeOptionsFile, raw);
            }
        }
Beispiel #2
0
        public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var propertyGroup = migrationRuleInputs.CommonPropertyGroup;

            var projectContext = migrationRuleInputs.DefaultProjectContext;
            var packOptions    = projectContext.ProjectFile.PackOptions;

            if (packOptions.PackInclude != null)
            {
                MigrationErrorCodes
                .MIGRATE20018("Migrating projects with Files specified in PackOptions is not supported.").Throw();
            }

            foreach (var propertyTransfrom in _propertyTransforms)
            {
                _transformApplicator.Execute(propertyTransfrom.Transform(packOptions), propertyGroup);
            }
        }
Beispiel #3
0
        public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs)
        {
            var projectContext           = migrationRuleInputs.DefaultProjectContext;
            var raw                      = projectContext.ProjectFile.RawRuntimeOptions;
            var outputRuntimeOptionsFile = Path.Combine(migrationSettings.OutputDirectory, s_runtimeOptionsFileName);

            if (!string.IsNullOrEmpty(raw))
            {
                if (File.Exists(outputRuntimeOptionsFile))
                {
                    MigrationErrorCodes.MIGRATE1015(
                        String.Format(LocalizableStrings.ProjAlreadyExistsError, outputRuntimeOptionsFile)).Throw();
                }

                var runtimeOptions = JObject.Parse(raw);
                if (HasServerGCProperty(runtimeOptions))
                {
                    bool serverGCValue = GetServerGCValue(runtimeOptions);

                    if (!IsServerGCValueInjectedBySdk(serverGCValue, projectContext.ProjectFile.GetProjectType()))
                    {
                        var propertyTransform = new AddPropertyTransform <bool>(
                            "ServerGarbageCollection",
                            gcValue => gcValue.ToString().ToLower(),
                            gcValue => true);

                        _transformApplicator.Execute(
                            propertyTransform.Transform(serverGCValue),
                            migrationRuleInputs.CommonPropertyGroup,
                            true);
                    }

                    RemoveServerGCProperty(runtimeOptions);
                }

                if (runtimeOptions.HasValues)
                {
                    File.WriteAllText(outputRuntimeOptionsFile, runtimeOptions.ToString());
                }
            }
        }