Asp.net

自定義配置部分的 Web.Config 轉換

  • August 17, 2015

有誰知道如何讓 web.config 轉換來替換自定義配置部分。我已將 msbuild 設置為詳細模式,並且轉換只是通過替換轉換忽略了自定義部分的存在。

web.config 轉換不關心自定義配置部分。它將對整個 web.config 文件進行替換。

這是我用來設置 memcached 伺服器 ips 的 web.config 替換的範例 XML:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
   <enyim.com>
       <memcached>
           <servers xdt:Transform="Replace">
               <add address="192.168.130.1" port="11211" />
               <add address="192.168.130.2" port="11211" />
               <add address="192.168.130.3" port="11211" />
           </servers>
       </memcached>
   </enyim.com>
</configuration>

引用自:https://stackoverflow.com/questions/4836403