I want to override a property in an external assembly via my config file
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting called "MySetting".
In my Web assembly's config file, how do I override the setting in BusinessLogic?
You need to add an applicationSettings sectionGroup to the config file:
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="[AssemblyName].Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
Then you need to add the following:
<[AssemblyName].Properties.Settings>
<setting name="[SettingToOverride]" serializeAs="String">
<value>[NewValue]</value>
</setting>
</[AssemblyName].Properties.Settings>
This allows you to override a setting without the need to redeploy
精彩评论