Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web.Config Transformations with Octopus Deploy

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

enter image description here

like image 811
MrBliz Avatar asked Apr 29 '14 11:04

MrBliz


1 Answers

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).

enter image description here

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.

like image 105
osij2is Avatar answered Oct 16 '22 01:10

osij2is