all groups > dotnet clr > july 2005 >
You're in the

dotnet clr

group:

updating the referenced assemblies in production servers


Re: updating the referenced assemblies in production servers Gael Fraiteur
7/21/2005 12:00:00 AM
dotnet clr:
The .NET runtime requires referenced assemblies to have exactly the same
version and public key as ther reference stored in the referencing assembly.
So effectively there can be difficulties when you want to give a new version
of a dependency.

There are two ways to overcome this problem:

1. Use <bindingRedirect> in the application configuration file and tells the
runtime to look for a newer version when an older version is requested, for
instance:
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
Note that you cannot change the public key token this way, but I do not see
the use to change the public key token when you change the version.

2. You can use a custom assembly binder in the application domain by using
the AppDomain.AssemblyRevolve event. We do it this way to allow an
application domain to load a newer version than expected. The problem here
is that you have to implement the binder from scrach (i.e locate the file,
check the version and load it using Assembly.LoadFile).

Hope it helped.

--
Gael Fraiteur
http://gael.fraiteur.net
----------------------------------------------------------------
Do you like declarative programming? Have a look at PostSharp,
an open-source post-compiler for .NET
http://gael.fraiteur.net/postsharp.aspx
----------------------------------------------------------------
[quoted text, click to view]

updating the referenced assemblies in production servers Fahad Ashfaque
7/21/2005 6:46:18 AM
Hi,

I have a problem updating the application. I have web application depending
on many other assemblies developed. I have fixed the versioning in
AssemblyInfo.cs for all, but I cannot fix the PublicKeyToken.

Problem is when I just update the build (dll) of any dependency (not the
application), the application gives error that assembly not found. This
problem does not persist when I update the application dll too.

Can someone help me in this? What is the best way to update the modules of
applications ?

Thanks in advance,
AddThis Social Bookmark Button