M
msnews.microsoft.com
I am having a heck of a time trying to figure out how to get a setting in a
referenced assembly/dll from the exe's app.config file. In other words, I
have an assembly called AcmeApp.exe which contains an app.config file. This
exe references a dll AcmeHelper.dll which I am trying to read a
configuration setting out of the app.config file but am unable to get it to
work properly. I am using the
ConfigurationManager.AppSettings.Get("CustomSetting") to get the value from
the app.config (in C# .NET 2.0) Does anyone have any input on what I am
doing wrong. (FYI: my dll and exe have different namespaces) I have
included what would seam logical to me for the app.config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AcmeApp.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/>
<section name="AcmeHelper.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/>
</sectionGroup>
</configSections>
<applicationSettings>
<AcmeApp.Properties.Settings>
<setting name="Test_Val1" serializeAs="String">
<value>AcmeApp_Title</value>
</setting>
</AcmeApp.Properties.Settings>
<AcmeHelper.Properties.Settings>
<setting name="CustomSetting" serializeAs="String">
<value>My Favorite Custom Setting</value>
</setting>
</AcmeHelper.Properties.Settings>
</applicationSettings>
</configuration>
referenced assembly/dll from the exe's app.config file. In other words, I
have an assembly called AcmeApp.exe which contains an app.config file. This
exe references a dll AcmeHelper.dll which I am trying to read a
configuration setting out of the app.config file but am unable to get it to
work properly. I am using the
ConfigurationManager.AppSettings.Get("CustomSetting") to get the value from
the app.config (in C# .NET 2.0) Does anyone have any input on what I am
doing wrong. (FYI: my dll and exe have different namespaces) I have
included what would seam logical to me for the app.config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AcmeApp.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/>
<section name="AcmeHelper.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/>
</sectionGroup>
</configSections>
<applicationSettings>
<AcmeApp.Properties.Settings>
<setting name="Test_Val1" serializeAs="String">
<value>AcmeApp_Title</value>
</setting>
</AcmeApp.Properties.Settings>
<AcmeHelper.Properties.Settings>
<setting name="CustomSetting" serializeAs="String">
<value>My Favorite Custom Setting</value>
</setting>
</AcmeHelper.Properties.Settings>
</applicationSettings>
</configuration>