Lately I’ve been working with streamlining a clients deployment process for several different EPi-sites. The CI server of choice is TeamCity and we decided to go with Octopus deploy when it came to automating deployment. The result is a pretty awesome continuous delivery process where we can push code from any check in directly to production should we like to.

Just one of the many features of Octopus is that it can easily run all your config transforms for you. And not only web.config, any config! This means we can easily make the pesky episerver.config and episerverframework.config transforms that we unavoidably need when we deploy any EPiServer site.

We ran into just one minor speed bump during the deployment process. It’s spelled license.config. Normally you just throw up the license.config for your different environments and leave it there, but it turns out that Octopus creates a new fresh directory for every deploy which means that if the license.config is not part of our deployment process it won’t get deployed to the new directory and we’ll face something similar to this beauty:

License error

Ah, the joy!

Turns out it’s really easy to fix this though. License.config is just another configuration file really, lets just transform it! However every developer has it’s own during development, so how do we do that?

We first need to add license.config to source control. Just add an empty one like this in a /licenses/ folder.

<Signature xmlns="">  
<!--This license file is just here for the transforms it's nothing to worry about, just put your own license.config in the site root as usual (but do not check it in to source control)-->

Add the appropriate config transform files e.g. license.staging.config, license.release.config etc. and make sure to run an insert on the appropriate sections:

<SignedInfo xdt:Transform="Insert" />
<SignatureValue xdt:Transform="Insert" />
<KeyInfo xdt:Transform="Insert" />

And then update your episerver.framework.config transforms to make sure it points to the new location of the license.config files.

<?xml version="1.0" encoding="utf-8" ?>
<episerver.framework xmlns:xdt="">

<licensing xdt:Transform="Insert" licenseFilePath="licenses/license.config" />

Note that this is for EPiServer 7. For EPi 6 you would need to transform the episerver.config (Check out this blog post for more info) instead, for EPi 5 you would just sit around and look sad that you haven’t upgraded yet.

That’s nice! We now have a continuous delivery process. Just one more thing… When we deploy through Octopus it does not automatically remove our config transformation files which leaves alot of junk web.environment.config files lying around. Unfortunately there’s no built in feature in Octopus that handles this (although there was an issue raised), but this is easily handled through a simple powershell script.

We add a file to our solution (make sure to set the Build Action to “Content” on the file). This file will be automatically picked up by Octopus and the script will run after deployment has completed.

Here’s the script:

get-childitem .\ -include *debug.config, *release.config, *staging.config -recurse | foreach ($_) {remove-item $_.fullname -force }

And that’s it. Continous delivery made easy with TeamCity and Octopus for EPiServer websites.