AssemblyVersion & AssemblyFileVersion

While both AssemblyVersion and AssemblyFileVersion attributes are used to version the assemblies, but you can use them to differentiate between the assembly version deployed on Live environment as against on your local development machines.

Both are present in the AssemblyInfo.cs (or .vb) class

[assembly: AssemblyVersion(“1.0.0.0”)][assembly: AssemblyFileVersion(“1.0.0.0”)]The AssemblyVersion is what other assemblies that reference your namespace will look at. If that number changes, then the referencing assembly will throw an exception. By default is AssemblyFileVersion is not set then it will be same as the AssemblyVersion. Increment it every time a new version of the assembly is deployed.

It is important to note that AssemblyVersion can be set to autoincrement by using *. example:

[assembly: AssemblyVersion(“1.0.0.*”)] will increment the revision number each time the assembly is built.

I am still not convinced by myself if one will ever need to use two of these seperately. If someone can help me, that will be great.

5 Responses to “AssemblyVersion & AssemblyFileVersion”

  1. Andrew Says:

    Check out this url for a good explanation of why both of these options exists.

    http://www.vbdotnetforums.com/showthread.php?t=13740

  2. Michael Lang Says:

    yes, there is a reason to use both attributes.

    AssemblyVersion defines the version other assemblies are compiled against in their manifest. A change in this requires a recompile of dependent assemblies.

    AssemblyFileVersion is informational only. Incrementing the version does not require a recompile of dependent assemblies. It helps when browsing your bin folder to know which code version you have installed.

    If you are making breaking changes to your API, you’ll want to increment AssemblyVersion. Non-breaking changes like implementation of current methods, or the addition of new types and methods you could increment just the AssemblyFileVersion. Typically this is done when creating a service pack or deploying bug fixes only.

    If you control all the code being deployed then you really don’t need it. Just re-compile your entire solution. The benefit comes in if you have plug-ins authored by other groups in your company, or by other companies.

  3. Richard Otter Says:

    Re:- AssemblyFileVersion is informational only.
    Don’t forget that the Windows Installer uses the file version to determine what do do when performing an upgrade install.

  4. Assembly Versioning in SharePoint » Andy Burns’ SharePoint Blog Says:

    […] time we update the version. Microsoft provide a good description of how to use it in KB556041, but a good, short description is: AssemblyVersion defines the version other assemblies are compiled against in their manifest.  A […]


Leave a comment