Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net web site - add version number automatically?

Is it possible in an asp.net web site project for it to increment a build version number automatically (and display it to our test team)

like image 466
Solyad Avatar asked Dec 28 '22 13:12

Solyad


1 Answers

Yes, in the AssemblyInfo.cs (or .vb, I guess) you can specify an [assembly: AssemblyVersion("1.1.*")] attribute. The "*" means that that part of the 4-part number is generated automatically (it's based on date and time).

You can read out that version number using this code:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version

That AssemblyInfo file should exist in every project, nowadays within a Properties folder.

like image 150
Hans Kesting Avatar answered Jan 19 '23 06:01

Hans Kesting