I have an assembly with two different versions (v1 and v2). Both versions of these assemblies have a custom ConfigurationSection. We set portions of this configuration section at the machine.config level. Everything works as you would expect for a single assembly in the GAC.
I now add v2 of the assembly to the GAC.
I add the new configuration section to the machine.config and point it to v2. All is well as they are both pointing to the same configuration section and reading the same section data.
Lets say one of the configuration values is a port number and I need the to be different on v1 than it is on v2. How do I handle this situation? Is there a way to alias the configuration sections to point to a different element in the machine.config file?
I thought about changing the name attribute on the config section to contain the version and then in the assembly I could load it dynamically using ConfigurationManager.GetSection("MyConfigSection" + MyCurVersionDeterminedSomehow) but this seems like a hack.
I could also have multiple versions of the configuration section class but this seemed to be an extremely wrong path.