I need to display the version number on the screen. I am using .net CF 2.0 with WinCE 4.0
So far, I have been ignoring the version number completely. Do I need to add anything to the assembly? how do I retrieve it programmatically?
Thanks!
I need to display the version number on the screen. I am using .net CF 2.0 with WinCE 4.0
So far, I have been ignoring the version number completely. Do I need to add anything to the assembly? how do I retrieve it programmatically?
Thanks!
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Revision
Source: http://msdn.microsoft.com/en-us/library/system.version.aspx
(Edit)
Application.ProductVersion Property
Gets the product version associated with this application.
Not Available In Compact Framework But System.Reflection.Assembly.GetExecutingAssembly().GetName().Version Is.
Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.productversion.aspx
Unfortunately this does not apply to COMPACT FRAMEWORK. Application.ProductVersion Property doesn't exist in CF. The latest part of your answer applies though. thanks!
one more question: do these properties (major, minor, build, revision) get incremented automatically or do I set them whenever i want to? the way I see it, revision should be automatically incremented with each new build....
You can also use Version.ToString() passing the number of components to return as parameter:
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3)
This line returns Major.Minor.Build
Source: http://msdn.microsoft.com/en-us/library/bff8h2e1(VS.80).aspx
There is an AssemblyInfo.cs in your project where you can edit your assembly version. To automatically increment the revision you can use something like this: 1.0.3200.*
Source: http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute(VS.80).aspx