public void Install(RunningDeployment deployment) { if (deployment.Variables.GetFlag(SpecialVariables.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings) == false) { return; } var appliedAsTransforms = deployment.Variables.GetStrings(SpecialVariables.AppliedXmlConfigTransforms, '|'); Log.Verbose("Looking for appSettings, applicationSettings, and connectionStrings in any .config files"); if (deployment.Variables.GetFlag(SpecialVariables.Package.IgnoreVariableReplacementErrors)) { Log.Info("Variable replacement errors are supressed because the variable Octopus.Action.Package.IgnoreVariableReplacementErrors has been set."); } var configurationFiles = fileSystem.EnumerateFilesRecursively(deployment.CurrentDirectory, "*.config"); foreach (var configurationFile in configurationFiles) { if (appliedAsTransforms.Contains(configurationFile)) { Log.VerboseFormat("File '{0}' was interpreted as an XML configuration transform; variable substitution won't be attempted.", configurationFile); continue; } replacer.ModifyConfigurationFile(configurationFile, deployment.Variables); } }
public void DoTransforms(string currentDirectory) { var appliedAsTransforms = variables.GetStrings(KnownVariables.AppliedXmlConfigTransforms, '|'); log.Verbose("Looking for appSettings, applicationSettings, and connectionStrings in any .config files"); if (variables.GetFlag(KnownVariables.Package.IgnoreVariableReplacementErrors)) { log.Info("Variable replacement errors are suppressed because the variable Octopus.Action.Package.IgnoreVariableReplacementErrors has been set."); } foreach (var configurationFile in MatchingFiles(currentDirectory)) { if (appliedAsTransforms.Contains(configurationFile)) { log.VerboseFormat("File '{0}' was interpreted as an XML configuration transform; variable substitution won't be attempted.", configurationFile); continue; } replacer.ModifyConfigurationFile(configurationFile, variables); } }