I know this has been posted elsewhere before, but I spent some time lately to figure this out again… And so, I thought I’d post this as a note to myself – to make my life easier next time I wonder why the xml transforms do not work with the episerver.config file of an EPiServer site.
I still remember the joy I felt when I saw the Web Deployment Made Awesome: If You’re Using XCopy, You’re Doing It Wrong video – note how the audience is clapping. Well, that’s two years ago, and xml transform for the config files has been the .Net standard since then.
However, things don’t work so well with the episerver.config file in EPiServer CMS. There’s a simple trick to make it work, however…
This is how the top of the episerver.config file normally looks:
<?xml version="1.0" encoding="utf-8"?>
<episerver xmlns="http://EPiServer.Configuration.EPiServerSection">
<sites>
...
Simply remove the namespace, like this:
<?xml version="1.0" encoding="utf-8"?>
<episerver>
<sites>
...
Now, you can use transform files, just as you can with Web.config and connectionStrings.config and all your other config files.
Like this:
Like Loading...
If I remember correctly, Visual Studio 2010 SP1 solves this problem so you can keep the namespace.
there’s also a project called SlowCheetah on github https://github.com/sayedihashimi/slow-cheetah
I think there is another approach – to add namespace to the transform instead of removing it from the configuration. Here is how you can do it:
1. Add epi namespace to the transform file
…
2. Use epi prefix for the changes related to the episerver section:
Ups.. xml was removed:
1. <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:epi="http://EPiServer.Configuration.EPiServerSection">
2. <epi:episerver>
<epi:sites>
<epi:site xdt:Transform="Replace" description="testDebug" … ></epi:site>
</epi:sites>
</epi:episerver>