我有一个web.config文件,我想使用SlowCheetah进行转换。相关片段如下所示:
<configuration>
<location path="ui/cms">
<system.web>
<authorization>
<allow roles="AAA" />
</authorization>
</system.web>
</location>
<location path="WebServices">
<system.web>
<authorization>
<allow roles="BBB" />
</authorization>
</system.web>
</location>
</configuration>我想将值BBB转换为CCC,所以我编写了Web.CCC.config转换文件:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="WebServices">
<system.web>
<authorization>
<allow roles="CCC" xdt:Transform="Replace" />
</authorization>
</system.web>
</location>
</configuration>不幸的是,它导致CCC被插入到<location path="ui/cms">中而不是<location path="WebServices">中--可能是因为它是第一个位于web.config文件中的。
如何让SlowCheetah注意到不同的path参数,并替换我的xml文件中的正确节点?
发布于 2016-01-22 15:57:53
事实证明,这可以使用转换文件中的xdt:Locator来获得。
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="WebServices" xdt:Locator="Match(path)>
<system.web>
<authorization>
<allow roles="CCC" xdt:Transform="Replace" />
</authorization>
</system.web>
</location>
</configuration>希望它对任何人都有帮助。即使是这样,橡胶鸭调试似乎也能工作。
https://stackoverflow.com/questions/34950526
复制相似问题