0
作爲我們安裝新版本的一部分,我們提供了web.config.delta文件,可以根據需要調整現有的web.config文件。現在我知道如何添加/更新/刪除AppSetting鍵(因爲我發現的所有帖子都是關於這個的),但我不知道該怎麼做的是添加新的節元素,添加新的節組。如何使用xmlmassupdate(msbuild)將新節添加到web.config
即。這是我的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" />
還是我必須爲節,sectiongroup和enterpriseLibrary.ConfigurationSource元素做同樣的事情?
謝謝!
您是否考慮使用MSDeploy解決此問題?有一個[來自MIX10的Scott Hanselman的精彩演示](http://channel9.msdn.com/events/MIX/MIX10/FT14)。 – Filburt
感謝您的建議將去檢查出來。我們已經建立了使用這個Mass XML Update的構建過程。幸運的是,我發現了一個單元測試,它可以通過反覆試驗來找出我需要做的事情。將看看其他演示:) – Jen
視頻很有趣 - 但我們還沒有使用VS2010 - 它看起來與我們正在做的類似。我們不使用XML-Document-Transform,而是使用XML Mass Update使用的語法。這只是記住你需要放置哪些位以及在哪裏:)加上我們的差異對於每個客戶端來說都是獨特的 - 而不是配置管理器模式(例如調試/發佈)。 – Jen