Having two projects: one is a class library (a .dll assembly) and the other is a GUI (.exe) using the class library.
In the class library, I've added two .settings files (which automatically adds the app.config file to the project) using all "application" settings. When I compile the project I effectively get the MyLib.dll.config file in the output directory.
Now, for the GUI project, I reference the class library and manually copy the MyLib.dll.config to the bin\debug (and release) folder.
I am trying to get the MyLib.dll.config settings from the GUI application but so far it is not working. I've tried having the .settings classes set to public but I was unsuccessful.
I've read about the OpenMappedExeConfiguration() method but I can't seem to find the settings in the returned config. Furthermore, how would I force the .settings classes to use the config returned by OpenMappedExeConfiguration?
Note: I do not want to manually add the entries from MyLib.dll.config to the app.config of the GUI application since those entries do not belong there at all.
Additional notes:
The .config file that I have is:
<?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="TestAssembly.ItemClass" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="TestAssembly.Entity" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<TestAssembly.ItemClass>
<setting name="Job" serializeAs="String">
<value>TrussPlant.Job</value>
</setting>
<setting name="Family" serializeAs="String">
<value>TrussPlant.Family</value>
</setting>
</TestAssembly.ItemClass>
<TestAssembly.Entity>
<setting name="TrussClassifier" serializeAs="String">
<value>TrussPlant.Classifier</value>
</setting>
<setting name="TrussComposer" serializeAs="String">
<value>TrussPlant.Composer</value>
</setting>
</TestAssembly.Entity>
</applicationSettings>
</configuration>
Note that there is a SectionGroup which contains the two sections.