Click here to Skip to main content
15,077,641 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't manage to get my app to reload or refresh it's loaded settings.
This is a section I have in my exe.config:

XML
<pre><runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="TestMode" publicKeyToken="22ws3erfvbgt6543" culture="neutral" />
        <bindingRedirect oldVersion="17.0.0.0-19.0.0.0" newVersion="19.1.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>


What I have tried:

I need to change the newVersion to 21.1.0.0 which I can do easily.
The question is how do you do this without shutting down the program.
Posted
Updated 28-Jan-21 17:20pm

1 solution

AFAIK, you cannot. It's applications runtime configuration which would need app to be stopped to reload for any change as it binding redirects would be mapped to app startup.

If you want to try, you can dynamically bind to a different version of an assemblytry using AppDomain.AssemblyResolve event which fired whenever the runtime is unable to locate the exact assembly that the application was linked against.

But again for a code change like this, you would need to restart app. So, without restarting - referring to another version would not be possible.
A good read: How the Runtime Locates Assemblies | Microsoft Docs[^]
   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900