I\'m trying to change assembly binding (from one version to another) dynamically.
I\'ve tried this code but it doesn\'t work:
Configuration con
RuntimeSection of the config file update at runtime using this code:
private void ModifyRuntimeAppConfig()
{
XmlDocument modifiedRuntimeSection = GetResource("Framework35Rebinding");
if(modifiedRuntimeSection != null)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSection assemblyBindingSection = config.Sections["runtime"];
assemblyBindingSection.SectionInformation.SetRawXml(modifiedRuntimeSection.InnerXml);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("runtime");
}
}
with Framework35Rebinding containing:
and an app.config containing (before the execution of the program):
Nevertheless it doesn't work for that I wanna do because assemblyBinding is only read at startup of the application whereas the RefreshSection("runtime")