PDA

Click to See Complete Forum and Search --> : Application versioning


VB-Mike
Nov 15th, 2001, 08:49 AM
How do you set the major, minor, build, and revision numbers in VB.NET? Looked all over the place in the IDE and cannot find it. Is this done automagically? Also, when I look at the exe version it is different then the major, minor, build, and revision numbers. Each time I do a build the exe version changes but not the major, minor, build, and revision numbers when doing a:

System.Environment.Version.Major.ToString
System.Environment.Version.Minor.ToString
System.Environment.Version.Build.ToString
System.Environment.Version.Revision.ToString

Cander
Nov 15th, 2001, 09:31 AM
Perhaps like in VB 6 there is an option somewhere that auto increments the version, but it may be selected by default in .NET. Ill have to look into that.

Joacim Andersson
Nov 15th, 2001, 11:18 AM
You can set the version and revision (or build) numbers in the AssemblyInfo.vb file (open it through the Solution Explorer).
Simply change the following row:<Assembly: AssemblyVersion("1.0.*")> The * specifies that it will default the revison number but you may hard code it if you like.

Best regards

VB-Mike
Nov 15th, 2001, 12:03 PM
Ok, that is getting closer. When I look at the version on the exe file it says what I specified in the AssemblyInfo.vb file. However when I set a var to System.Environment.Version.ToString I get another set of numbers completely different.

VB-Mike
Nov 15th, 2001, 12:23 PM
Got it!

Major: System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Lo cation).FileMajorPart

Minor: System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Lo cation).FileMinorPart

Revision: System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Lo cation).FileBuildPart

Thanks again for everyones help!