When it was introduced, .NET provided an easy way to mark each version of your program with a "Major, Minor, Build, and Revision" number. But it seems that every good thing gets complicated and that has happened here too.
There are three of these numbers now and they can all be different. And there are at least four places where you will see them. And there are different names for them, depending on where they appear.
This Quick Tip explains what they are and how they can effect your system.
Let's start with the way things used to be. When .NET was introduced, there was a parameter in the AssemblyInfo.vb file which could also be changed in the project properties of the source. Here's the relevant line from AssemblyInfo.vb.
The four numbers are Major, Minor, Build and Revision. They would (usually) appear in the Details tab of the file properties. And life was good.
Today, there is a possibility of three different places where a version number can appear.
In AssemblyInfo.vb, both an AssemblyVersion and an AssemblyFileVersion appear now.
--------
Click Here to display the illustration
--------
Both of these can also be changed using the Application tab, Assembly Information button of project properties.
--------
Click Here to display the illustration
--------
The AssemblyInfo.vb versions are accessed by Framework utilities (See the article on the SN Framework tool.) and by Windows.
If you view the version in the manifest of an executable, this is the version you will see. The illustration below shows the version number in an assembly manifest.
--------
Click Here to display the illustration
--------
AssemblyVersion is used by Framework during build and at runtime to locate, link and load assemblies. If a project contains a reference to an assembly, this version is used, for example. This is also the version used by Framework utilities like SN.exe.
The AssemblyFileVersion is used in the Windows file system. Framework doesn't use it. This is the version that will usually appear in the Details tab of the properties of a file. (This tab is displayed by a Windows Explorer shell extension, so the content can be different.)
--------
Click Here to display the illustration
--------
Microsoft created two assembly versions because they wanted to allow developers to be able to rapidly update the version number for their own internal control purposes. A big project will create a new version at least once a day. At the same time, they didn't want to force this to creating a new number that would appear in the file version visible outside the project.
In the Publish tab of the project properties, a completely different "version" appears. This is usually called the Publish version. (Would this be called a new version of version?)
--------
Click Here to display the illustration
--------
This version is not, strictly speaking, part of the solution source code. Instead it's in the GACUTIL_Test.vbproj file where it's accessed by the Publish wizard.
The version number in the Publish tab is used by the ClickOnce publish wizard. ClickOnce will check for newer versions as they become available and automatically replace any updated files.
Calling both of these "version numbers" is simply confusing because they're actually independent systems. Assembly version numbers aren't used when using the Publish feature of Visual Studio and vice versa. Both can be accessed from VB code, however.
--------
Click Here to display the illustration
--------
Be careful when accessing the CurrentVersion, however. If you haven't published the system, this statement will cause your code to crash on an exception error.
There are three of these numbers now and they can all be different. And there are at least four places where you will see them. And there are different names for them, depending on where they appear.
This Quick Tip explains what they are and how they can effect your system.
Let's start with the way things used to be. When .NET was introduced, there was a parameter in the AssemblyInfo.vb file which could also be changed in the project properties of the source. Here's the relevant line from AssemblyInfo.vb.
<Assembly: AssemblyVersion("1.2.3.4")>
The four numbers are Major, Minor, Build and Revision. They would (usually) appear in the Details tab of the file properties. And life was good.
Today, there is a possibility of three different places where a version number can appear.
In AssemblyInfo.vb, both an AssemblyVersion and an AssemblyFileVersion appear now.
--------
Click Here to display the illustration
--------
Both of these can also be changed using the Application tab, Assembly Information button of project properties.
--------
Click Here to display the illustration
--------
The AssemblyInfo.vb versions are accessed by Framework utilities (See the article on the SN Framework tool.) and by Windows.
If you view the version in the manifest of an executable, this is the version you will see. The illustration below shows the version number in an assembly manifest.
--------
Click Here to display the illustration
--------
AssemblyVersion is used by Framework during build and at runtime to locate, link and load assemblies. If a project contains a reference to an assembly, this version is used, for example. This is also the version used by Framework utilities like SN.exe.
The AssemblyFileVersion is used in the Windows file system. Framework doesn't use it. This is the version that will usually appear in the Details tab of the properties of a file. (This tab is displayed by a Windows Explorer shell extension, so the content can be different.)
--------
Click Here to display the illustration
--------
Microsoft created two assembly versions because they wanted to allow developers to be able to rapidly update the version number for their own internal control purposes. A big project will create a new version at least once a day. At the same time, they didn't want to force this to creating a new number that would appear in the file version visible outside the project.
In the Publish tab of the project properties, a completely different "version" appears. This is usually called the Publish version. (Would this be called a new version of version?)
--------
Click Here to display the illustration
--------
This version is not, strictly speaking, part of the solution source code. Instead it's in the GACUTIL_Test.vbproj file where it's accessed by the Publish wizard.
<ApplicationRevision>3</ApplicationRevision><ApplicationVersion>4.3.2.%2a</ApplicationVersion>
The version number in the Publish tab is used by the ClickOnce publish wizard. ClickOnce will check for newer versions as they become available and automatically replace any updated files.
Calling both of these "version numbers" is simply confusing because they're actually independent systems. Assembly version numbers aren't used when using the Publish feature of Visual Studio and vice versa. Both can be accessed from VB code, however.
--------
Click Here to display the illustration
--------
Be careful when accessing the CurrentVersion, however. If you haven't published the system, this statement will cause your code to crash on an exception error.
SHARE