Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing multiple .settings classes from a class library, how to proceed?
    primarykey
    data
    text
    <p>Having two projects: one is a class library (a .dll assembly) and the other is a GUI (.exe) using the class library.</p> <p>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.</p> <p>Now, for the GUI project, I reference the class library and manually copy the MyLib.dll.config to the bin\debug (and release) folder.</p> <p>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.</p> <p>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?</p> <p><strong>Note:</strong> 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.</p> <hr> <p><strong><em>Additional notes:</em></strong></p> <p>The .config file that I have is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt; &lt;section name="TestAssembly.ItemClass" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;section name="TestAssembly.Entity" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;applicationSettings&gt; &lt;TestAssembly.ItemClass&gt; &lt;setting name="Job" serializeAs="String"&gt; &lt;value&gt;TrussPlant.Job&lt;/value&gt; &lt;/setting&gt; &lt;setting name="Family" serializeAs="String"&gt; &lt;value&gt;TrussPlant.Family&lt;/value&gt; &lt;/setting&gt; &lt;/TestAssembly.ItemClass&gt; &lt;TestAssembly.Entity&gt; &lt;setting name="TrussClassifier" serializeAs="String"&gt; &lt;value&gt;TrussPlant.Classifier&lt;/value&gt; &lt;/setting&gt; &lt;setting name="TrussComposer" serializeAs="String"&gt; &lt;value&gt;TrussPlant.Composer&lt;/value&gt; &lt;/setting&gt; &lt;/TestAssembly.Entity&gt; &lt;/applicationSettings&gt; &lt;/configuration&gt; </code></pre> <p>Note that there is a <em>SectionGroup</em> which contains the two sections.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload