equivilent of app.major & app.minor etc

  • Thread starter Thread starter Harry Hudini
  • Start date Start date
H

Harry Hudini

After the flame war :) that discussed whether VB calls are now depreciated
(though the programmers certainly arent thankfully) I thought I would ask;

Whats the current .net way getting the major and minor (and the rest)
properties of my apps exe ?

Olly
 
Major:
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major

Minor:
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor
 
You gotta give it to .net, it certainly has some catchy and easy to remember
functions :)
 
Harry said:
After the flame war :) that discussed whether VB calls are now depreciated
(though the programmers certainly arent thankfully) I thought I would ask;

Whats the current .net way getting the major and minor (and the rest)
properties of my apps exe ?

Olly

I use:

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

If you do a 'ToString(2) on the result you will get a '1.0' string which
is handy for most things.

R.
 
How do i manually increase the minor and major version numbers in vs2003 ? i
used to be able to do it in the project properties, but i cant find that now
 
Harry said:
How do i manually increase the minor and major version numbers in vs2003 ? i
used to be able to do it in the project properties, but i cant find that now
It is in AssemblyInfo.cs

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

The '*' will get replaced by the build number - defined as the number of
days since, um, 1/1/2000 i think, some such calculation anyway.

R.
 
Remember that this is the CFx (Compact Framework) not the DFx (Desktop
Framework). With the DFx you could use "Application.ProductVersion" to
return a string representing the major.minor.build.revision of your
application. If you really needed to get the major.minor.build.revision
elements individually then you could use the following code:

Dim ver As New Version(Application.ProductVersion)
' ver.Major
' ver.Minor
' ver.Build
' ver.Revision

There are usually many different ways to accomplish the same task with the
DFx because of the shear size and complexity to it. However, I'm sure that
leaving out certain functionality to try to reduce the overall size of the
CFx was not an easy task for the dev team. Yes, things are not always
glaringly obvious but overall it's not too difficult to understand where to
go and what to look for when you're trying to locate the correct BCL
property, method, event, etc.
 
Back
Top