public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs) { var projectContext = migrationRuleInputs.DefaultProjectContext; var compilationOptions = ResolveCompilationOptions(projectContext, "Debug"); var sources = GetCompilationSources(projectContext, compilationOptions); var assemblyAttributeList = GetWhitelistedKnownAssemblyAttributes(sources); foreach (var assemblyAttribute in assemblyAttributeList) { var propertyTransform = new AddPropertyTransform <string>( assemblyAttribute.GenerateAssemblyAttributePropertyName, a => "false", a => true); _transformApplicator.Execute( propertyTransform.Transform(assemblyAttribute.AttributeName), migrationRuleInputs.CommonPropertyGroup, true); } }
public void Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs) { var projectContext = migrationRuleInputs.DefaultProjectContext; var compilationOptions = ResolveCompilationOptions(projectContext, "Debug"); var sources = GetCompilationSources(projectContext, compilationOptions); var assemblyInfoList = GetAssemblyInfo(sources); foreach (var assemblyInfo in assemblyInfoList) { var propertyTransform = new AddPropertyTransform <string>( $"Generate{assemblyInfo}Attribute", a => "false", a => true); _transformApplicator.Execute( propertyTransform.Transform(assemblyInfo), migrationRuleInputs.CommonPropertyGroup, true); } }
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()); } } }