0

新しいバージョンのインストールの一部として、既存のweb.configファイルを適切に調整するweb.config.deltaファイルがあります。これで、AppSettingキーを追加/更新/削除する方法がわかりました(これに関するすべての投稿がこれに関するものであるため)が、方法がわからないのは、新しいセクション要素を追加し、新しいセクショングループを追加することです。

すなわち。これは私のweb.configのすべての新しいものです。「デルタ」として適用するには、何を変更する必要がありますか?

<?xml version="1.0"?>
<configuration xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate">

<configSections>
<section xmu:key="name" name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section xmu:key="name" name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />

<sectionGroup name="authorization" type="Company.Security.Configuration.AuthorizationSectionGroup, Company.Library">
      <section name="rowLevelSecurity" type="Company.Security.Configuration.RowLevelAuthorizationSection, Company.Library"/>
      <section name="typeBasedSecurity" type="Company.Security.Configuration.TypeAuthorizationSection, Company.Library"/>
    </sectionGroup>

</configSections>

<enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source">
    <sources>
      <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add name="Security-FileBasedConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        filePath="Config/Enterprise-Security.config" />
    </sources>
    <redirectSections>
      <add sourceName="Security-FileBasedConfigurationSource" name="securityConfiguration" />
    </redirectSections>
  </enterpriseLibrary.ConfigurationSource>

  <authorization>
    <rowLevelSecurity defaultProvider="SqlMembershipRowLevelSecurity">
      <providers>
        <add name="SqlMembershipRowLevelSecurity" type="Company.Security.DataAuthorization.SqlMembershipRowLevelSecurityProvider, Company.Library"  applicationName="app1" connectionStringName="SecurityConnection"/>
      </providers>
    </rowLevelSecurity>
    <typeBasedSecurity defaultProvider="SqlInPlaceTypeBasedSecurity">
      <providers>
        <add name="SqlInPlaceTypeBasedSecurity" type="Company.Security.Providers.SqlEntityTypeFunctionTypeSecurityProvider, Company.Common"  applicationName="app1" connectionStringName="SecurityConnection"/>
      </providers>
    </typeBasedSecurity>
  </authorization>

</configuration>

このようなものに関する簡単な情報を見つけることができないようですが、間違った用語でグーグルしているのかもしれません。

次のような追加ビットを置き換える必要がありますか?

<add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

<add xmu:key="name" name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmu:action="add" />

または、section、sectiongroup、enterpriseLibrary.ConfigurationSource要素に対して同じことを行う必要がありますか?

ありがとう!

4

1 に答える 1

0

ありがたいことに、マージを行っている単体テストを見つけたので、メモリ内でマージ後に XML を確認できました。したがって、試行錯誤を使用して、以下が必要であることがわかりました。

<?xml version="1.0"?>
<configuration xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate" xmlns:un="http://schemas.microsoft.com/practices/2010/unity">

  <configSections>
    <section xmu:key="name" name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" xmu:action="add" />
    <section xmu:key="name" name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" xmu:action="add"/>

    <sectionGroup xmu:key="name" name="authorization" type="Company.Security.Configuration.AuthorizationSectionGroup, Company.Library" xmu:action="add">
      <section xmu:key="name" name="rowLevelSecurity" type="Company.Security.Configuration.RowLevelAuthorizationSection, Company.Library" xmu:action="add"/>
      <section xmu:key="name" name="typeBasedSecurity" type="Company.Security.Configuration.TypeAuthorizationSection, Company.Library" xmu:action="add"/>
    </sectionGroup>

  </configSections>

  <enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source">
    <sources>
      <add xmu:key="name" name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmu:action="add" />
      <add xmu:key="name" name="Security-FileBasedConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        filePath="Config/Enterprise-Security.config" xmu:action="add" />
    </sources>
    <redirectSections>
      <add xmu:key="name" sourceName="Security-FileBasedConfigurationSource" name="securityConfiguration" xmu:action="add" />
    </redirectSections>
  </enterpriseLibrary.ConfigurationSource>

  <authorization>
    <rowLevelSecurity defaultProvider="SqlMembershipRowLevelSecurity">
      <providers>
        <add xmu:key="name" name="SqlMembershipRowLevelSecurity" type="Company.Security.DataAuthorization.SqlMembershipRowLevelSecurityProvider, Company.Library"  applicationName="app1" connectionStringName="SecurityConnection" xmu:action="add" />
      </providers>
    </rowLevelSecurity>
    <typeBasedSecurity defaultProvider="SqlInPlaceTypeBasedSecurity">
      <providers>
        <add xmu:key="name" name="SqlInPlaceTypeBasedSecurity" type="InPlace.Security.Providers.SqlEntityTypeFunctionTypeSecurityProvider, InPlace.Common"  applicationName="app1" connectionStringName="SecurityConnection" xmu:action="add"/>
      </providers>
    </typeBasedSecurity>
  </authorization>

  <un:unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <un:container>
      <un:register xmu:key="type" type="Company.Interface.Logging.ILoggingProvider, Company.Library" mapTo="Company.NHibernate.LoggingProvider, Company.NHibernate" xmu:action="add">
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" type="Company.Interface.Security.ITaskAuthorizationManager, Company.Library" mapTo="Company.EnterpriseLibrary.Security.TaskAuthorizationManager, Company.EnterpriseLibrary" xmu:action="add" >
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" type="Company.Interface.Security.ITypeAuthorizationManager, Company.Library" mapTo="Company.EnterpriseLibrary.Security.TypeAuthorizationManager, Company.EnterpriseLibrary" xmu:action="add" >
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" type="Company.Interface.Security.IPropertyAuthorizationManager, Company.Library" mapTo="Company.EnterpriseLibrary.Security.PropertyAuthorizationManager, Company.EnterpriseLibrary" xmu:action="add" >
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" type="Company.Interface.Security.IRoleAuthorizationManager, Company.Library" mapTo="Company.Web.Security.RoleAuthorizationManager, Company.Library" xmu:action="add">
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" type="Company.Interface.Security.IRowLevelAuthorizationManager, Company.Library" mapTo="Company.Web.Security.RowLevelAuthorizationManager, Company.Library" xmu:action="add">
        <un:lifetime type="singleton" />
      </un:register>
      <un:register xmu:key="type" name="TypeSecurityProvider" type="Company.Security.TypeBasedAuthorization.TypeSecurityProvider, Company.Library" mapTo="Company.Security.Providers.SqlEntityTypeFunctionTypeSecurityProvider, Company.Common" xmu:action="add"/>
    </un:container>
  </un:unity>

</configuration>
于 2011-07-12T05:11:44.690 に答える