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)
+4
A:
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.
Hans Kesting
2010-06-23 07:29:07
I guess same question as above. This is a web site project which is not producing a dll, this would probably work if it was a web application project?
Solyad
2010-06-25 11:27:13
+4
A:
In order to autoincrement the version of the assembly at each build you could use the following assembly attribute:
[assembly: AssemblyVersion("1.0.*")]
and to read the version at runtime of the currently executing assembly you could use the Version property:
Assembly.GetExecutingAssembly().GetName().Version
Darin Dimitrov
2010-06-23 07:29:30
Will this work on an asp.net web site project which is not producing a dll (except what it builds in the windows temp .net folder)?
Solyad
2010-06-25 11:18:26
No probably it won't work. It would be better to place this code into a custom assembly over which you have control and call it from code behind.
Darin Dimitrov
2010-06-25 11:20:40