XDT usage in config transform blows up

Jun 15, 2011 at 10:19 PM

If I have a

web.release.config.transform with the element

<system.web>
    <authentication mode="Forms" xdt:Transform="Replace">
      ....
    </authentication>
  </system.web>

Upon usage of this package it blows up with Update-Package : 'xdt' is an undeclared prefix. Line 21, position 34.

Note, I do understand that applying the transform is not supported. I specifically want to install the appropriate config transform for my dependent application.

Jun 15, 2011 at 10:40 PM

Have you tried adding the namespace declaration in there? e.g. make it the same way as the web.config.debug that VS generates.

Jun 16, 2011 at 12:36 PM
davidebbo wrote:

Have you tried adding the namespace declaration in there? e.g. make it the same way as the web.config.debug that VS generates.

Yikes, if you change web.release.config.transform to be

<configuration  xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

When in you install the package it changed my existing config transformations

Original -    <section name="userOverride" xdt:Transform="Remove" xdt:Locator="Match(name)" />

Modified +    <section name="userOverride" p3:Transform="Remove" p3:Locator="Match(name)" xmlns:p3="http://schemas.microsoft.com/XML-Document-Transform" />

This also had nothing relevant to the config actually inside of my package

It seems to have transformed every single usage of xdt:... inside my config during installation to be p2, p3.

Jun 16, 2011 at 4:41 PM

Not sure I'm following you. Where are p2 and p3 coming from? What do you mean by "This also had nothing relevant to the config actually inside of my package". Can you show exactly what your web.release.config.transform looks like (in a minimal scenario that demonstrates the issue)?

Jun 17, 2011 at 3:25 PM
davidebbo wrote:

Not sure I'm following you. Where are p2 and p3 coming from? What do you mean by "This also had nothing relevant to the config actually inside of my package". Can you show exactly what your web.release.config.transform looks like (in a minimal scenario that demonstrates the issue)?

The instances of P2 and P3 were created when the transform was installed into the project. That <section name="userOverride" xdt:Transform="Remove" xdt:Locator="Match(name)" /> was part of the current project's release.config. It was an existing line. In my nuget package there is absolutely nothing about userOverride. However when I installed the package it mutated that line to the <section name="userOverride" p3:Transform="Remove" p3:Locator="Match(name)" xmlns:p3="http://schemas.microsoft.com/XML-Document-Transform" />

So nuget was changing my file all over the place on config sections that had nothing to do with the nuget package that was being installed after I made the

nuget web.config.release.transform file start as <configuration  xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

Apparently the XML processor has some major issues when it wants to merge the files when the .transform file defines xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" and so does the release.config, that it alters all of the original usage of the xdt: identifiers and creates new ones, the P2, and P3.

Jun 17, 2011 at 3:40 PM

You may want to file a bug for tracking. Please make sure you include the full content of your web.release.config.transform file, as well as the full resulting output that you are getting. I did a quick test and did not see any problems, so there must be differences.