WSP Versioning
Versioning for WSP packages are possible, but we have to do
it manually.
· Embed the version number in the filename of the
WSP.
· Create a text file with the version information
inside the package.
Solutions don’t have a version number included by default
and it is recommended to add a version number to the solution name. With this
approach we know which version of your solution is deployed.
For instance:
Use MyProjectSolution_v5000.10.1560.0.wsp
as solution name for the build #1560.
AssemblyFileVersion
The AssemblyFileVersion is intended to uniquely
identify a build of the individual assembly
Used for deployment. You can increase this number for every
deployment. It is used by setup programs. Use it to mark assemblies that have
the same AssemblyVersion, but are generated from different builds.
In Windows, it can be viewed in the file
properties.
Example:
// Assembly mscorlib, Version 2.0.0.0
[assembly: AssemblyFileVersion("5000.10.1560.0")]
[assembly: AssemblyInformationalVersion("5000.10.1560.0")]
[assembly: AssemblyVersion("5000.10.0.0")]
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.
Code to read the current Assembly File Version
Assembly thisAssembly = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(thisAssembly.Location);
Console.WriteLine(fvi.FileVersion);
PowerShell Command
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("Location
of your executable").FileVersion
PowerShell script can be used to update the AssemblyFileVersion when the project is
build.
Source: