我正在使用可通過VS2010使用的web.config轉換。在這種情況下,我想知道在轉換過程中是否可以將元素與另一個元素「包圍」。這裏有一個例子:Web.config轉換 - 圍繞元素
默認的web.config包含:
<configuration>
<system.web>
....
</system.web>
</configuration>
我轉換文件應包含
<configuration>
<location inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>
</configuration>
所以基本上我想「包裝」與位置system.web元素元件。我唯一的想法就是做一個轉換,以便我之前和之後一樣插入:
<location inheritInChildApplications="false"
xdt:Transform="InsertBefore(/configuration/system.web)">
</location xdt:Transform="InsertAfter(/configuration/system.web)">
但收盤位置元素是不是按照VS有效的XML(我猜是因爲變換屬性)。只需在system.web之前插入一個自我關閉的位置元素也無濟於事,因爲生成的system.web仍未被「包圍」。
有沒有想過這個?我目前正在研究這種確切的情況。 – 2016-06-14 11:14:01