Geeks With Blogs
Bryan Corazza for ( ; ; ) { BizTalk, Workflow, and .NET }

Have you ever wanted to upgrade a version of an assembly and not have to recomplie code?  One way to accomplish this is using assembly binding in your configuration file.  First make sure that both the old assembly and the new one use the same strong key file and are both in the GAC.  Then add the following to your application configuration file:

<configuration>

  <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >

      <dependentAssembly>

        <assemblyIdentity

                name="DevelopMentor.Mandelbrot"

                publicKeyToken="be418bc72a93105f" />

        <bindingRedirect oldVersion="1.0.0.0"

                             newVersion="2.0.0.0" />

        </dependentAssembly>

    </assemblyBinding>

  </runtime>

</configuration>

Next time the application configuration is refreshed and run, the new version will be loaded instead of the old one.  This is a great way to perform updates in a production-like environment without recompiling the assemblies involved.  I cannot tell you how many times I've seen versioning cripple a .NET project, especially once assemblies are in production.  Enjoy.

-B

 

Posted on Tuesday, May 23, 2006 2:15 PM General .NET | Back to top


Comments on this post: .NET 2.0 Assembly Version Redirection

# re: .NET 2.0 Assembly Version Redirection
Requesting Gravatar...
Good One
Left by Saikat on Jul 10, 2009 7:43 AM

Your comment:
 (will show your gravatar)


Copyright © Bryan Corazza | Powered by: GeeksWithBlogs.net