0

以下のスタイルの web.config 変換を使用して、さまざまな環境または設定に展開するときに変換を実行できることはわかっていますが、私の質問は、web.config の別のセクションをこの手法または他の設定で完全に置き換えることができるかどうかです。例<System.IdentityModel> </System.IdentityModel>別の環境にデプロイするときに完全に変更したいセクションがあります。それは可能ですか?

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an attribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB" 
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->

</configuration>
4

1 に答える 1

0

構成ファイルのセクション全体を置き換えることができる ConfigZilla と呼ばれる NuGet のプロジェクトがあります。.template.configをファイルに処理することで機能し.config、そこで任意の Xslt 変換を行うことができます。ここに例がありますhttp://philipdaniels.com/configzilla/templates.html

ConfigZilla は、Web 構成変換と比較してわずかに異なるアプローチをとっています。よりスケーラブルになるように、構成を一元化するために懸命に努力しました。

于 2014-07-28T09:02:28.147 に答える