SYSK 2: A word on versions – deployment, assembly, file…

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(“”)] attribute.  In VS2005, there is now UI for the ProductVersion — Project Properties->Application Tab->Assembly Information.  Programmatically, you can get this version by calling Application.ProductVersion property.

File version existed in VS2003, although some people didn’t know about it because it wasn’t automatically added to AssemblyInfo.cs.  AssemblyFileVersion attribute is what the shown in Version tab in Windows Explorer when you look at assembly 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 by calling System.Deplolyment.ApplicationDeployment.CurrentDeployment.CurrentVersion property (make sure to check that the deployment was done via ClickOnce by calling System.Deployment.ApplicationDeployment.IsNetworkDeployed).

It usually makes sense to keep ProductVersion and DeploymentVersion in sync, but you don’t have to.  

If the application is deployed via ClickOnce, it is  recommended to display the deployment version.
For more information, check out the MSDN Webcast: Using Visual Studio’s ClickOnce Technology to Deploy a Smart Client Application (Level 200)

Comments (5)

  1. Thank you very much for this info.

    There is al litte problem with the namespace

    This works fine on my machine:

    private void helpToolStripButton_Click(object sender, EventArgs e)


    String msg = "Not available";

    if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)

    msg += string.Format("nApplication Version {0}", System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion);





  2. Phil says:

    OK, that makes a few things clear.  I’m wondering how I can automate the keeping in synch of the deployment version with the assembly version.  The deployment version is automatically increased each time I publish, but this does not affect the assembly version in any way.



  3. irenak says:

    On my projects, we do it in the deployment script, i.e. the deployment script changes the assembly version to match the deployment version during the build phase…

  4. Spencer says:

    Could you please post the code from your deployment script which changes the assembly version to match the deployment version during the build phase?



  5. irenak says:

    Sorry — it’s been so long ago, I no longer have access to the code.