Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web config transform on microsoft.identityModel - 'http://schemas.microsoft.com/XML-Document-Transform' attribute is not declared

I have got a Web.Release.config that is successfully transforming a connection string.

When I add a microsoft.identityModel section I get a warning saying

The 'http://schemas.microsoft.com/XML-Document-Transform' attribute is not declared

And the transform doesnt work on that section.

What am I missing to get the transform to work?

Complete Web.Release.config here

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

  <connectionStrings>    

    <add name="MYNAME"
         connectionString="metadata=res://*/Models.MYCOMPANY-Sales-Demo.csdl|res://*/Models.MYCOMPANY-Sales-Demo.ssdl|res://*/Models.MYCOMPANY-Sales-Demo.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=MYCOMPANYDemo;UID=MYCOMPANYDBUser;Password=********;multipleactiveresultsets=True;App=EntityFramework&quot;"         
         xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
  </connectionStrings>

  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
  </system.web>


  <microsoft.identityModel> 
    <service>
      <audienceUris>
        <add value="http://MYCOMPANY-sales-demo.cloudapp.net/" xdt:Transform="Replace"/>
      </audienceUris>
      <federatedAuthentication>
        <wsFederation realm="http://MYCOMPANY-sales-demo.cloudapp.net/" xdt:Transform="SetAttributes(realm)" />
      </federatedAuthentication>       
    </service>
  </microsoft.identityModel>

</configuration>
like image 535
Paul Rowland Avatar asked Dec 15 '11 00:12

Paul Rowland


People also ask

What is xdt transform?

XDT is a simple and straight forward method of transforming the web. config during publishing/packaging. Transformation actions are specified using XML attributes defined in the XML-Document-Transform namespace, that is mapped to the xdt prefix.

How do I create a new transformation in web config?

If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).

What is Web config transform?

A Web. config transformation file contains XML markup that specifies how to change the Web. config file when it is deployed. You can specify different changes for specific build configurations and for specific publish profiles.


1 Answers

I've run into this also but have gotten it to work. What I did was a "RemoveAll" and an "Insert" instead of a replace/match:

<audienceUris>
    <add xdt:Transform="RemoveAll" />
    <add value="http://example.com/" xdt:Transform="Insert" />
</audienceUris>

When I do it that way I get the desired transform and output config file.

like image 78
Steve Avatar answered Nov 09 '22 09:11

Steve