AssemblyVersion vs. AssemblyFileVersion

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,462
Programming Experience
10+
VB 2005 gives us direct control of these through the "My Project" assembly information area. I'm trying to decide the value of both Assembly (AV) and File Versions(AFV) for at least my particular use. I know for component vendors that want to issue a "binary compatible" update, they can leave the AssemblyVersion the same but increment the AssemblyFileVersion and allow a file to be updated without breaking compatibility with the references. I also am aware ClickOnce cares about the AFV and not AV.

Are there any good articles, reference docs, anything that would help us get a good understanding as to when to use AV vs. AFV? What are the ramifications, typical uses, etc.?

Share your expertise...
 
Assembly version, a.k.a. product version is used by CLR when loading dependent assemblies. As in .NET 1.X, you can see/change the ProductVersion in assembly manifest by using [assembly:AssemblyVersion(“2.1.6.432”)] attribute. In VS2005, there is now UI for the ProductVersion --

Project Properties->Application Tab->Assembly Information.

Programmatically, you can get this version by calling

VB.NET:
Application.ProductVersion
File version existed in VS2003, although some people didn’t know about it because it wasn’t automatically added to AssemblyInfo.vb. AssemblyFileVersion attribute is what is shown in Version tab in Windows Explorer when you look at an assemblies properties. If you want compatibility, don't change the AssemblyVersion, but use the AssemblyFileVersion to track your builds and versions; only increment the AssemblyVersion when you are breaking compatibility and want to force a recompile and
allow side-by-side execution.

Note: if you exclude the AssemblyFileVersion, then the value is set to the same as AssemblyVersion. Check out FileVersionInfo class for more info.

Finally, with ClickOnce, we now have the deployment (a.k.a. publish version). This is what’s used to figure out if the client installation is up-to-date or a newer version is available. Programmatically, you can get this version using
VB.NET:
System.Deployment.ApplicationDeployment.CurrentDeployment.CurrentVersion
You can also check whether or not deployment was implemented using ClickOnce ....

VB.NET:
System.Deployment.ApplicationDeployment.IsNetworkDeployed
 
It also appears that the FileVersion is used for items such as storage paths of settings. I was reading up on the My.Application.Log class and the location in which the log file is created and how it depends upon your FileVersion. I believe the My.Settings is the same. Therefore, there are times you may want to change the FileVersion and then there are times you don't, i.e. losing all previously saved settings when publishing an update with a new FileVersion?!?
 
Back
Top