Welcome to MSDN Blogs Sign in | Join | Help

FileVersion and GAC

Every assembly has an identity, which includes name, version, culture, and public key/token. Also every binary in Windows can have a file version. The file version is orthogonal to assembly version, and there is no co-relation at all. You can change them independently. And file version is not used in binding decision at all. For .Net assembly, it is pure informational.

Unless the assembly is about to be installed to GAC.

In .Net framework 1.1 we introduce the file version when you install assemblies into GAC. It only applies when the assembly you are about to install already exist in GAC. When we see the assembly already exists in GAC, we try to compare the file version of the assembly in GAC(let's call it “old” assembly), and the file version of the assembly about to install(and “new“ assembly). If the “new” assembly's file version is lower than the “old” assembly's, we will refuse to install the “new” assembly, unless you ask fusion to force install (“gacutil -if“).

The intention is that replacing assembly with old bits is almost a mistake 99% of the time. You really have to “force” us to do the “wrong” thing.

Published Saturday, February 14, 2004 7:53 AM by junfeng
Filed under:

Comments

# re: FileVersion and GAC

Saturday, February 14, 2004 8:39 AM by Justin Rogers
Okay, I kind of see what you are saying, but not quite. Say I have application A: that runs against MyAssembly, v1.0, and application B: that runs against MyAssembly, v2.0. Now, application A is pretty old and not many people have it, but lots of people have application B. Now, what happens when someone goes to install my application A and my old assembly gets pushed in.

You see, when .NET was first released we were told that it didn't matter if multiple versions of the same assembly were in the GAC because the right version would get selected at load time. So why wouldn't you allow the older assembly to simply install? What the the problems since you haven't listed any in your post.

# re: FileVersion and GAC

Saturday, February 14, 2004 8:57 AM by Junfeng Zhang
The multiple versions of the same assembly you are talking about, is Assembly Version. It has nothing to do with File Version this post talks. As I pointed out in this post, Assembly Version and File Version are orthogonal. Multiple assembly versions will be installed side by side to different locations, and will not slash each other. This post is talking about assembly with the same assembly version, but different file versions.

Like, this is not about MyAssembly, v1.0/v2.0. This is about MyAssembly, v1.0, file version v1. and MyAssembly, V1.0, file version v2.

Does it make sense?

# re: FileVersion and GAC

Saturday, February 14, 2004 11:22 AM by Justin Rogers
Ah, foot in mouth, should have more thoroughly read your post. Thanks for pointing out the difference.

# re: Sample Managed GAC API Wrappers

Wednesday, September 15, 2004 3:19 PM by Junfeng Zhang's .Net Framework Notes

# Famous Quotes » Junfeng Zhang’s Windows Programming Notes : Sample Managed GAC API Wrappers

New Comments to this post are disabled
 
Page view tracker