2011-12-06 7 views
1

マニフェストのConfigコンポーネントがweb.configに新しい構成設定を配置する方法を見てみましょう。しかし、私はそれを私のためにコレクションを追加し、すでにそこにある場合は新しいブロックを追加することはできないようです!具体的にはDotNetNuke 6マニフェスト| Configコンポーネント

、私はそうのようなマニフェスト内のWebサービス参照を追加している:

<component type="Config"> 
     <config> 
     <configFile>web.config</configFile> 
     <install> 
      <configuration> 
      <nodes> 
       <node path="/configuration" action="update" collision="ignore"> 
       <system.serviceModel> 
        <bindings> 
        <basicHttpBinding> 
         <binding name="xxx"> 
         </binding> 
        </basicHttpBinding> 
        </bindings> 
        <client> 
        <endpoint address="http://xxx" binding="basicHttpBinding" bindingConfiguration="xxx" contract="xxx" name="xxx" /> 
        </client> 
       </system.serviceModel> 
       </node> 
      </nodes> 
      </configuration> 
     </install> 
     </config> 
    </component> 

セクションは、これらのブロックの一つがファイル内に既にあります場合でも、web.configファイルに追加されます。私は間違って何をしていますか?

乾杯!

<component type="Config"> 
    <config> 
     <configFile>web.config</configFile> 
     <install> 
     <configuration> 
      <nodes> 
      <node path="/configuration/dotnetnuke/sitemap/providers" action="update" key="name" collision="overwrite"> 
       <add name="DNNSimpleArticleSiteMapProvider" type="DotNetNuke.Modules.dnnsimplearticle.Providers.Sitemap.Sitemap, DNNSimpleArticle" providerPath="~\DesktopModules\dnnsimplearticle\Providers\Sitemap\" /> 
      </node> 
      </nodes> 
     </configuration> 
     </install> 
     <uninstall> 
     <configuration> 
      <nodes /> 
     </configuration> 
     </uninstall> 
    </config> 
    </component> 
+0

です言ったように

<component type="Config"> <config> <configFile>web.config</configFile> <install> <configuration> <nodes> <node path="/configuration" action="update" collision="overwrite"> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="xxx"> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://xxx" binding="basicHttpBinding" bindingConfiguration="xxx" contract="xxx" name="xxx" /> </client> </system.serviceModel> </node> </nodes> </configuration> </install> <uninstall> <configuration> <nodes> </nodes> </configuration> </uninstall> </config> </component> 

、あなたが個別に各レベルを追加する必要があります。それは、このコードは動作するはずです意味しますか?もしそうなら、私の質問は解決されます。 http://blog.usmanahmed.info/beware-of-component-type-config-during-same-p – karbonphyber

答えて

3

私は同じ問題があり、アンインストールタグを追加することで修正されました。ブルース・チャップマンはこの適用

+1

どのように機能しますか? – karbonphyber

+1

​​の後にタグを追加するだけです。 Bruce Chapmanが以前に言ったように、各ノードを別々に追加する方が良いでしょう。 – Ehsan

0

は、上書きの代わり

EXを無視し、衝突を変更してみてください。

最初に、あなたの例では、すべてのweb.configファイルにある/ configuration要素の衝突を回避するよう試みます。

次に、各部分を分離する必要があります。これはアンインストールにも重要です。

あなたの例では、あなたはいくつかのレベル持っている - 彼らは、各要素の「キー」(すなわち名前、アドレスによって識別することができますので、あなたがする必要がどのような<system.servicemodel> , <bindings>, <basicHttpBinding>などに

は、これらの独立して分割され、 - それが何であれ)。これにより、マージエンジンはコリジョンを識別し、更新を行います。

次は単なる推測ですが、有用なジャンプポイントになるはずです。把握するのは容易ではなく、この分野の文書は少しばかりです。私は自分自身でこれを理解するためにソースコードに深く没頭しました。

<component type="Config"> 
    <config> 
    <configFile>web.config</configFile> 
    <install> 
     <configuration> 
     <nodes> 
      <node path="/configuration" targetpath="/configuration/system.serviceModel" action="update" collision="ignore"> 
      <system.serviceModel> 
       <bindings> 
       <basicHttpBinding> 
       </basicHttpBinding> 
       </bindings> 
       <client> 
       </client> 
      </system.serviceModel> 
      </node> 
      <node path="/configuration/system.serviceModel/bindings/basicHttpBinding" action="update" key="name" collision="overwrite"> 
       <binding name="xxx"> 
       </binding> 
      </node> 
      <node path="/configuration/system.serviceModel/client" action="update" key="address" collision="overwrite"> 
      <endpoint address="http://xxx" binding="basicHttpBinding" bindingConfiguration="xxx" contract="xxx" name="xxx" /> 
      </node> 
     </nodes> 
     </configuration> 
    </install> 
    </config> 
</component> 

編集:TARGETPATH-属性は小文字で書かれなければなら 、そうでない場合はインストーラが重複要素を作成します。 (元の回答:targetPath)

+0

Chrisがまだ新しいセクションを作成しようとしました。 "キー"が付いていないコレクション全体を追加する予定なのでしょうか? – karbonphyber

+0

上記のあなたのコメントは正しいかもしれません。返信する前に私は見ていません –

+0

この場合の上書きの問題は、他のモジュールのsystem.serviceModelノードの下に他のサービスがある可能性があることです。 –

3

設定マージを使用している場合、それは個別のブロックの各レベルを処理するのが最善です: