Web.config transformation issue

I have a deployment that has occurred. I checked the Web.Config file and the two roles that should have been released have not been replaced. When trying to figure out where those roles are currently, I checked the contents of the package and found the values inside of the package. It would seem that when the package was deployed, it kept it values and did not do the transformation as the log file shows.

I have the configuration options ch and conifgure transform options checked inside of octopus as part of my deployment process. I also have the values that should be transformed defined as variables and scoped to the appropriate environments. Can anyone assist in why my web.config file isn’t being changed being that everything appears to be in place.

Hi,

Thanks for getting in touch! The common issue with configuration transforms not working are when the transform itself is not in the same directory as the web.config or output file.
Other times it is when the additional transforms have not been completed with the correct syntax. You may also need to create a new release if anything in your process or NuGet package has changed.

If it isn’t any of these things, can you please send through a screenshot of your project step transformation section, a screenshot of your package where the files are to see if we can figure out why they aren’t working.

Hope that helps!
Vanessa

Hey Vanessa,

Thanks for reaching out and assiting in solving this issue. I’m attaching a few images, I am trying to modify the roles tags in the web config. When the job runs, it isn’t picking up the items in the web config itself. I’m uploading images for the process configuration in octopus, the directory for where the webconfig is, the variables inside octopus, and the webconfig to show what is in the config file.

webconfig.png

Hi,

Okay so the values you are trying to replace are not part of the existing config transforms and values that Octopus completes. Octopus will only replace values for anything inside AppSettings or ConnectionStrings. Anything outside of that you have three options:

  1. use the Substitute Variables in Files feature and add them as Octopus Variables (this will break the code locally however).
  2. Use this step template: https://library.octopusdeploy.com/#!/step-template/actiontemplate-file-system-find-and-replace
  3. Write a powershell script to find and replace the values.

Vanessa

I recommend the Substitute Variables feature, OP.

‘Substitute Variables’ ended up being generally applicable and the better option for doing this. We’re currently replacing many variables in our *.config files successfully using this method instead of the more limited ‘Configuration Variables’ option.