问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/24059257/how-do-i-enable-intellisense-in-vs-2013-for-rewrite-in-transform-config