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.
July 22, 2008 at 4:29 pm
Check out this url for a good explanation of why both of these options exists.
http://www.vbdotnetforums.com/showthread.php?t=13740
August 19, 2008 at 1:47 pm
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.
January 22, 2009 at 9:03 pm
Wrote a little to keep the two in sync (or only update on a certain configuration build).
December 23, 2009 at 10:29 pm
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.
May 18, 2011 at 10:32 am
[…] 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 […]