6

I decided I wanted to move some rewrite rules into our web.release.config and web.staging.config files in order to keep the rewrite rules relevant to the environments our different configurations run on.

IntelliSense didn't like this decision and wouldn't play ball because:

xdt:Transform "attribute is not declared"

for the <rewrite> element.

I looked at RuslanY's solution here and I considered several solutions on this site but none of them provided the solution to this particular problem in VS 2013 with .NET v4.5. I have also studied this old MSDN post here and ensured the Schemas property of the Web.config, Web.Staging.config and Web.Release.config are pointing at the correct transform schema version.

It seems the only solution is to edit the DotNetConfig[v].xsd files and add

<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/>

to the end of each <xs:complexType> within each of <xs:element name="rewrite">'s elements (and <xs:element name="rewrite">'s markup itself) to bring them into line with other elements that have good IntelliSense.

Is this the correct solution in this case (because it seems strange that these entries aren't already in existence)? Is there a better way of adding these entries to the xsd files so they won't be lost on a VS update (and so they will be easier to apply on a VS install)?

Or is there another solution that I should be deploying?

Raghavendra
  • 1,419
  • 4
  • 19
  • 28
lukkea
  • 3,606
  • 2
  • 37
  • 51
  • 2
    I'm seeing the same warning message, xdt:Transform "attribute is not declared" however the transformation seems to work ok. Seems like Microsoft needs to fix the schemas. – PrgTrdr Jun 09 '14 at 18:08
  • @PrgTrdr With the fix outlined in my question above, as far as I can tell at the moment... I will add it as an answer when I'm more confident that this doesn't introduce any bugs. – lukkea Jun 10 '14 at 11:38
  • 1
    I just encountered the same problem in a 4.5.1 project and the simpler solution was to Transform the rewrite element with "Replace". – lukkea Oct 28 '14 at 14:43
  • @lukkea, using the Transform attribute on the rewrite element with any value (including "Replace") triggers the warning for me (VS2013.4, 4.52). – osoviejo Mar 04 '15 at 04:20
  • @osoviejo that would be what I would expect - but, if you add the xs:anyAttribute element I detail above to each xs:complexType, and to the xs:element, the warning should go away for you, I hope... – lukkea Mar 04 '15 at 09:20

1 Answers1

0

As I say in my question: It seems the only solution is to edit the DotNetConfig[v].xsd files and add

<xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/>

to the end of each <xs:complexType> within each of <xs:element name="rewrite">'s elements (and <xs:element name="rewrite">'s markup itself) to bring them into line with other elements that have good IntelliSense.

lukkea
  • 3,606
  • 2
  • 37
  • 51