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.

Comments (5)

  1. 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.

  2. 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?

  3. Ah, foot in mouth, should have more thoroughly read your post. Thanks for pointing out the difference.