views:

279

answers:

1

Hi Guys,
I have an assembly with few versions registered in the GAC. Now, I want one of my clients which uses this assembly (version 1.3) to point to the newest version (1.4) without opening the source and recompiling the client.
I saw an article demonstrating a technique for doing so using the application config file (winform application)

here is the config file content :

<?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.0 to 1.4.0.0 for assembly named MyFacade.

Now, there's only a Minor issue with this approach. It doesn't work :)

I'm sure it's something with my code.

Any suggestions?

Thanks,
Adi Barda

A: 

Hi Adi,

first, this is the best source I've found about this subject. There are some differences, for example, they are not using the asm: namespace, and also, you might want to disable the publisher policy by adding <publisherPolicy apply="no" /> as described in the article.

In a previous project we did, we needed even more control, so we needed to catch the AppDomain.AssemblyResolve Event and route to any assembly we wanted. Here you can find more informations about the concept. You'd have to manipulate your app once, though.

Hope that helps,

best regards,
Thomas

moonground.de