Assembly Version Checking in .Net

588 views Asked by At

I am trying to fully get my head around assembly versions and strong names in .NET

I found This Assembly Versioning Article stating that only Major.Minor.Build is used in version matching. I cannot find anything that can confirm/deny this.

Assembly Version Format ... Revision:
Assemblies with the same name, major, and minor version numbers but different revisions are intended to be fully interchangeable. This would be appropriate to fix a security hole in a previously released assembly.

MS Articles say things like:

The assembly version number is part of an assembly's identity and plays a key part in binding to the assembly and in version policy... Version checking only occurs with strong-named assemblies.

Does this mean that say 1.0.0.0 and 1.0.0.1 are interchangeable in a strong name environment but 1.0.1.1 is not?

What is the definitive answer, please?

2

There are 2 answers

1
Joe On BEST ANSWER

I didn't find anything in the linked article stating that only Major.Minor.Build is used in version matching. In fact all four components of a version are used.

The key point is intended to be interchangeable. Whether or not they are actually interchangeable depends on the author, who is free to respect or ignore the MS guidelines.

A vendor of a shared assembly that is installed in the GAC can supply a publisher policy file to redirect from old to new version of the assembly. He should only do this if the new version is backward compatible with the old one.

1
Spontifixus On

The assembly's AssemblyVersion-attribute is being evaluated completely when comparing versions. Meaning that changing one part of the version number will result non-matching assemblies.

One way to work around this is to let the AssemblyVersion-attribute always unchanged e.g set to [AssemblyVersion("1.2.3.0")]and use the AssemblyFileVersion-attribute for changing versions such as revisions, e.g. [AssemblyFileVersion("1.2.3.20120909")]. That gives you the possibility to update the version of a strongly named assembly without updating all references.