C # How to redirect assembly using application configuration file

I have an assembly with several versions registered in the GAC. Now I want one of my clients that uses this assembly (version 1.3) to point to the latest version (1.4) without opening the source or recompiling the client. I saw an article demonstrating the technique for this using the application configuration file (winform application)

here is the contents of the configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
  <!-- one dependentAssembly per unique assembly name -->
  <asm:dependentAssembly>
    <asm:assemblyIdentity
       name="MyFacade"
       publicKeyToken="c9c18e16df1654e0" />
    <!-- one bindingRedirect per redirection -->
    <asm:bindingRedirect oldVersion="1.3.0.0"
                  newVersion="1.4.0.0" />
  </asm:dependentAssembly>
</asm:assemblyBinding>
</runtime>
</configuration>

As you can see, there is a binding redirect from version 1.3.0.0to 1.4.0.0build with a name MyFacade.

Now there is only a minor issue with this approach. This does not work:)

I am sure this is something with my code.

Any suggestions?

Thanks
Adi Barda

+3
1

. . , , asm:, , <publisherPolicy apply="no" />, .

, AppDomain.AssemblyResolve Event , . . .

+3

Source: https://habr.com/ru/post/1747824/


All Articles