Anders G. Nordby

Senior Systems Consultant at Making Waves AS

Using xml transform with episerver.config

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.

About these ads

4 Responses to Using xml transform with episerver.config

  1. Magnus Rahl (@magnustweet) 2012-04-29 at 07:03

    If I remember correctly, Visual Studio 2010 SP1 solves this problem so you can keep the namespace.

  2. Peter 2012-04-30 at 07:06

    there’s also a project called SlowCheetah on github https://github.com/sayedihashimi/slow-cheetah

  3. Sergii Vorushylo (@SergVro) 2012-04-30 at 09:06

    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:

  4. Sergii Vorushylo (@SergVro) 2012-04-30 at 09:08

    Ups.. xml was removed:
    1. <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform&quot; xmlns:epi="http://EPiServer.Configuration.EPiServerSection"&gt;
    2. <epi:episerver>
    <epi:sites>
    <epi:site xdt:Transform="Replace" description="testDebug" … ></epi:site>
    </epi:sites>
    </epi:episerver>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: