Questions tagged [xdt]

Abbreviation for XML Document Transform, a method to transform web.config during publishing or packaging.

Definition:

According to the Official Documentation:

A transform file is an XML file that specifies how the Web.config file should be changed when it is deployed. Transformation actions are specified by using XML attributes that are defined in the XML-Document-Transform namespace, which is mapped to the xdt prefix. The XML-Document-Transform namespace defines two attributes: Locator and Transform. The Locator attribute specifies the Web.config element or set of elements that you want to change in some way. The Transform attribute specifies what you want to do to the elements that the Locator attribute finds.

In short, XDT is an abbreviation for XML Document Transform, a method to transform web.config during publishing or packaging.

Example Usage:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <connectionStrings>
        <add name="MyDB" 
            connectionString="value for the deployed Web.config file" 
            xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
    <system.web>
        <customErrors defaultRedirect="GenericError.htm"
            mode="RemoteOnly" xdt:Transform="Replace">
            <error statusCode="500" redirect="InternalError.htm"/>
        </customErrors>
    </system.web>
</configuration>

Important Links:

31 questions
8
votes
0 answers

NuGet release.config.install.xdt Retain Transforms

I'm creating a NuGet package that contains a web.release.config.install.xdt file. But, every transform in the file is processed by NuGet. Here's the contents of the web.release.config.install.xdt file:
bellwether
  • 81
  • 2
5
votes
1 answer

XDT Transform of web.config is Append possible

I'm trying to update an existing appSettings in my web.config. I don't want to replace the entire value, but append my new value to the end. Is this possible? Current value: Required…
Ian Houghton
  • 249
  • 3
  • 19
4
votes
4 answers

Trying to replace XML element element using XDT and XPath locator

Hi I am trying to replace the using VS2012 XDT by using the following transform on a quartz.net job description file. I have tested the XPath locator using an online tester and it returns 'what i think i need'. Any help is…
PingCrosby
  • 369
  • 4
  • 17
3
votes
0 answers

XDT Transform attribute with namespace

i'm working on nuget package for xamarin.android and i need to transform AndroidManifest.xml what i need is to add android:sharedUserId attribute to root element called manifest
qwertylolman
  • 141
  • 1
  • 1
  • 8
2
votes
3 answers

How to insert as first child in app.config

I'm currently authoring a new NuGet package, but I can't get the app.config.install.xdt file right (which is the xml file that transforms app.config to suit the installed package). The problem is inserting a section in app.config as…
2
votes
1 answer

XDT transformation removes wrong entry

I am using this site to test my XDT transformations before using in NuGet. When i have this config
Jeroen Heier
  • 3,520
  • 15
  • 31
  • 32
2
votes
1 answer

Move XML element using XDT

Is there a way to move an XML element, including all of its content, inside another element using XDT? For example, I'd like to transform the following XML: someContent into…
f4st
  • 473
  • 2
  • 10
2
votes
1 answer

How do I use XDT transforms with my own XML file?

How to I tell my MSBuild (probably in my project file) that I want to use XDT transforms on my own XML file? I have the standard Web.config and Web.Release.config which Visual Studio shows as a dependent file of Web.config. I also have foo.config…
maxmoore14
  • 701
  • 7
  • 26
2
votes
1 answer

Possible to use XDT to transform custom xml in nuget package?

I've created a nuget package that needs to add some configuration to an existing xml file on installation. The xml file is located deep in the folder structure like: /app/config/site1/settings.xml Is it possible to use XDT to transform this file and…
Kulvis
  • 655
  • 11
  • 33
2
votes
2 answers

Issue with app.config transformation upon installing on new solution

I have a package which applies app.config transformations upon project. Transform file looks like this