Config Transforms not working on Azure

I am attempting to deploy an azure web role. Service Configuration transformation works fine. The deployment occurs and my role is available in staging. However environment web.config transforms do not appear in the target instance.

When I look at the log for the deployment I see it logging all the transforms. It clearly finds my web.[env].config file, and it appears to work through transforming all the attributes. After azure deployment however, the version of the web config on the server is not the transformed one.

By looking at the temporary folders on the server while deployment is in operation, we can see the web.config has been correctly transformed (in situ), just nothing seems to happen to put this on the azure target environment.

My package is structured as follows (and deploying to an environment called QA02)

 - cloudservice.cspkg
- ServiceConfiguration.QA02.cscfg
- Web.Config
- Web.Release.Config
- Web.QA02.Config

I have two questions

  1. After the transform, does Octopus put the transformed file into the cspkg for deployment? Or is it supposed to apply post-deployment steps.
  2. Are my config transform files in the correct place - there doesn’t seem to be any docs on this point.



Hi Paul,

Unfortunately while Octopus will run the config transform, it won’t “re-pack” the cspkg for you. To do this you would need to write your own scripts to do this with PowerShell, or have the transforms run at build time.

This is something we’d like to build into Octopus but we haven’t had chance to do it just yet.


I have resolved this by changing my msbuild parameters to publish using the /p:OutDir parameter. My artifact includes all the possible transforms, service configurations and the results of this output directory. I then use a custom Deploy.ps1 to cop;y the octopus-transformed web.config back into the correct site directory before calling CSPACK manually. I’ll write it up as a blog post quite soon, as it is useful to people (and should probably be in your next version :wink: )

Devenney, sounds like an interesting post :slight_smile: Did you write it up already by any chance?

Yeah, please post your result!

I posted a question on stack overflow about manipulating the cspkg in case anyone knows how to answer it. I’m also very interested in getting Azure transform support built into Octopus.

Hi David,

It seems like you have found a solution?
As for your comment “getting Azure transform support built into Octopus” we agree, and it will be part of 3.0.
And for my mind reading ability to know you are going to ask when is 3.0 coming out, I don’t have an answer for that, apart from after 2.6 :wink:


Hey Vanessa, I documented what I did and made a sample solution to demonstrate the concepts. It can be found in my public git repo:

Hope this helps some folks while we wait for 3.0.

Hi David,

This is awesome, thanks for creating this and sharing it with everyone.
(I’ve shared it with the team here).