Incrementing the Assemblyversion

Asked

Viewed 731 times

7

I am creating an upgrade solution for an application I have and needed the Assembly version

When placing an * on Assembly.

[assembly: AssemblyVersion("1.0.0.*")]

it started incrementing automatically, but the way it is incrementing is added 5 digits in the last house. Ex.

1.0.0.29058

I would like to know if it is possible to configure Assemblyversion so that it increments automatically and with only one digit in the last box for easy comparison between versions.

I am getting the Assemblyversion in the application as follows:

string versionAssembly = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

and the comparison I’m using in the application is:

 if (Convert.ToDouble(version) >= Convert.ToDouble(versionAssembly))
 {
     //code here
 }
  • Related: http://answall.com/questions/2867/incrementar-versao-automaticamente-obternumero-versao-via-codigo

1 answer

6


In that case, by * in your file AssemblyInfo.cs you are getting the amount of seconds passed since midnight (following the Coordinated Universal Time) divided by two.

To make the increment with only one digit, I suggest you take a look at Build Version Increment. The official versions cover until the VS 2010, but you can get a modification for the 2012 here. By accessing the settings, you can change the versioning style of the last identifier (home) to Increment, adding +1 to each compilation.

Alternatively, you could follow the usage pattern of *

[assembly: AssemblyVersion("x.x.*")] 

to assign the number of days passed since the beginning of January 2000 to the second-to-last version indicator, and to the last the seconds count as shown above. Then all you have to do is make a comparison "Datetime" to determine the latest version as required.


Note: I suggest that you carefully analyze how versioning identification will be done because by adapting it to the development characteristics of the project, the management of the teams' results or development steps becomes more functional. Adapting to MSDN documentation, version can be briefly represented as follows: VersãoPrincipal.VersãoMenor.Compilação.Revisão

  • Main Version: can indicate a rewrite of the product in which it is not guaranteed the compatibility with previous versions, indicating the making of extensive modifications.
  • Minor Version: may represent a point of release of the product in which minor modifications were included, and may or may not be compatible.
  • Compilation: represents the recompilation of the code, and its number can be modified in case of change of processor, platform or compiler.
  • Revision: consists of minor repairs that tend to ensure full compatibility with previous versions.

However, in certain cases it may be feasible to reverse the last two identifiers (compilation and revision). In this way, the revision could represent a repair (without the insertion of new functionalities) to the lasso of a Minor Version, and the compilation could simply identify the latter build in question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.