I want to apply web.config transformations with Octopus Deploy, but only on the production environment.
I don't want to create separate configs for all of our other environments.
At the moment i'm using this following custom expression but it doesn't apply the transformation
Are you specifically trying to change key/value pairs within the web.config file of your project? XML transforms are a different function altogether. Read the documentation here: http://docs.octopusdeploy.com/display/OD/Configuration+files. That documentation will refer as well to MS documentation on transforms: http://msdn.microsoft.com/en-us/library/dd465326.aspx
Having said that, it looks like you mean to say you want to change the value of configuration variables within Octopus. Octopus can definitely do that; especially when targeting a specific environment. Go to the "Variables" tab in your project. Within the variable tab, the "Name" column refers to the value you want to change in your web.config or app.config. This is the EXACT name as it appears in the file so you don't have to change anything directly in the file to match.
The value is of course the value to appear. Then the Variable Scope column will allow you to specify the environment, server, roles and even step within the process (mine doesn't appear as this is a blank project).
Edit: Read this documentation from Octopus Deploy on config files (and further down is web transformations). It looks like your custom expression for the transform are incorrect if you're trying to remove the debug mode flag. Judging by the expression you input, it will render as "TrueProduction.Production" which really doesn't describe any type of transformation. You should probably try this instead:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
Make sure you have your production Web config file as: Web.Production.config if you only want to apply it for Production. Make sure that Web..Config matches that environment name in Octopus. Again, it's in the documentation on the Octopus Deploy site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With