我必须将大型.net 1.1应用程序迁移到.net 3.5。
系统使用Configuration Management Application Block(CMAB)从app.config文件开始加载配置文件:
<configuration>
<configSections>
<section
name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManagerSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3" />
<section
name="MyAppSystemSettings"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.XmlHashtableSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3" />
</configSections>
<appSettings>
<!-- Key / Value Pairs -->
</appSettings>
<!-- ## Configuration Management Settings ## -->
<applicationConfigurationManagement defaultSection="MyAppSystemSettings">
<configSection name="MyAppSystemSettings">
<configCache enabled="true" refresh="* 6 * * *" />
<configProvider
assembly="Microsoft.ApplicationBlocks.ConfigurationManagement, Version=1.0.0.0,Culture=neutral,PublicKeyToken=e64cb664730084d3"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileStorage"
signed="false"
refreshOnChange="false"
encrypted="false"
path="C:\Program Files\MyApp\Config\MyAppSystemSettings.Config" />
</configSection>
</applicationConfigurationManagement>
</configuration>
可以看出这是引用MyAppSystemSettings.Config'sub'配置文件,如下所示:
<configuration>
<MyAppSystemSettings>
<XmlSerializableHashtable xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entries>
<Entry>
<key xsi:type="xsd:string">Key0</key>
<value xsi:type="xsd:string">Value0</value>
</Entry>
<Entry>
<key xsi:type="xsd:string">Key1</key>
<value xsi:type="xsd:string">Value1</value>
</Entry>
<Entry>
<key xsi:type="xsd:string">ExtraConfigFile</key>
<value xsi:type="xsd:string">C:\Program Files\MyApp\Config\ExtraConfig.xml</value>
</Entry>
</XmlSerializableHashtable>
</MyAppSystemSettings>
</configuration>
考虑到app.config文件引用类似于MyAppSystemSettings.Config的10+'sub'配置文件,并且它们每个包含100多个条目,我正在寻找最简单的方法来迁移它们以正确使用System.Configuration给我与使用CMAB的.net 1.1解决方案相同的结果?