I'm writing a .NET DLL (C#) that is an add-in for a 3rd party product. That product includes this in it's application.exe.config file:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
My DLL targets .NET v3.5, and my app.config file includes this:
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="myDLL.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
When I use the Settings object (derived from ApplicationsSettingsBase) to save a setting, the save works - and the data is saved to the user.config file of the host application. However, it is saved with this in it (note the Version=4.0.0.0):
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="myDLL.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="anotherVendorsDLL.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
With these settings saved, my DLL will not load the settings on subsequent runs of the host application. The supportedRuntime of the application.exe.config has an impact on this - changing or deleting it will mean that the user.config file is saved with a different Version=X.X.X.X in it. With Version=2.0.0.0 my settings load just fine.
How can I get my settings to load/save without a problem without updating the host application.exe.config file? Or do I need to consider using an alternative storage location for my application settings, such as my own XML config file or registry?