468,168 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,168 developers. It's quick & easy.

GAC assembly versioning policy QFE behavior

I am trying to get QFE (Quick Fix Engineering) working with an assembly
installed in the GAC. I have two books that claim if two different version
of the assembly are installed in the GAC -AND- they vary only by revision
number, then the default policy is to load the higher number version. I am
not able to reproduce this behavior in practice.

My test case is simple. I wrote a class with AssemblyVersion 1.0.0.1.
Installed into GAC. Created a console application that reference this
assembly to verify it works. I then created a second assembly (with the same
assembly name) and made it version 1.0.0.2. I installed this into the GAC.
I verified that both version exist by using the GUI viewer for the GAC. I
then reran my console application without recompiling. It is still using the
1.0.0.1 version (the class I built returns the version number so I know this
for certain).

So my question is why won't won't the CLR recognize that a newer version is
available and automatically start using it?

Thank You

James Tyner
..NET Developer
Mar 24 '06 #1
2 1991
I have two books that claim if two different version
of the assembly are installed in the GAC -AND- they vary only by revision
number, then the default policy is to load the higher number version. I am
not able to reproduce this behavior in practice.


Your books are wrong, and the behaviour you've observed is the way
it's designed to work. Unless you tell it otherwise, the CLR will only
bind to the exact version that was referenced.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mar 24 '06 #2
Following is a small part of an email i sent to some of our developers
to handle this same issue. Hopefully it gives you enough information to
at lease figure out where to look.
----------------------------
There is a way to create and register an item called a Publisher Policy
Assembly. You can then redirect all users of a dll to a new version.
Following are the steps.

First create the configuration file. This has the same information that
I previously put in the application configuration file.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="StrongLibrary"
publicKeyToken="6b5322bd2869c315"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="1.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Then make a Publisher Policy Assembly. This is done using the assembly
linker tool.
al /link:publisherPolicyFile /out:publisherPolicyAssemblyFile
/keyfile:keyPairFile
In this command:
The publisherPolicyFile argument is the name of the publisher policy file.
The publisherPolicyAssemblyFile argument is the name of the publisher
policy assembly that results from this command. The assembly file name
must follow the format: policy.majorNumber.minorNumber.mainAssemblyName.dl l
The keyPairFile argument is the name of the file containing the key
pair. You must sign the assembly and publisher policy assembly with the
same key pair.

The following is the command I used in my prototype.
al /link:policy.config /out:policy.1.0.StrongLibrary.dll
/keyfile:StrongLibrary.snk

You then use the gacutil to register the policy.
gacutil /I policy.1.0.StrongLibrary.dll
---------------------------------------------------
Hope that helps
Leon Lambert

jtyner wrote:
I am trying to get QFE (Quick Fix Engineering) working with an assembly
installed in the GAC. I have two books that claim if two different version
of the assembly are installed in the GAC -AND- they vary only by revision
number, then the default policy is to load the higher number version. I am
not able to reproduce this behavior in practice.

My test case is simple. I wrote a class with AssemblyVersion 1.0.0.1.
Installed into GAC. Created a console application that reference this
assembly to verify it works. I then created a second assembly (with the same
assembly name) and made it version 1.0.0.2. I installed this into the GAC.
I verified that both version exist by using the GUI viewer for the GAC. I
then reran my console application without recompiling. It is still using the
1.0.0.1 version (the class I built returns the version number so I know this
for certain).

So my question is why won't won't the CLR recognize that a newer version is
available and automatically start using it?

Thank You

James Tyner
.NET Developer

Mar 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Simon Wallis | last post: by
2 posts views Thread by Ily | last post: by
1 post views Thread by jtyner | last post: by
6 posts views Thread by Ben | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.