Access asymbly version
-
Hi All, I need to display my assembly version on about form. I am not quite sure how get it and display on a label. if know please let me know. thaks,
Google says...
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
...you can determine the version of your application in the AssemblyInfo.cs file which may be found in the Properties folder of your solution (VS 2010) EDIT: Slight correction of Google found code
Illogical thoughts make me ill
-
Hi All, I need to display my assembly version on about form. I am not quite sure how get it and display on a label. if know please let me know. thaks,
You can get the version for the application with Application.ProductVersion[^]. For an individual assembly you can use something like
Assembly.GetExecutingAssembly().GetName().Version
which may, or may not give the same result as the first suggestion.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
-
Hi All, I need to display my assembly version on about form. I am not quite sure how get it and display on a label. if know please let me know. thaks,
-
Google says...
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
...you can determine the version of your application in the AssemblyInfo.cs file which may be found in the Properties folder of your solution (VS 2010) EDIT: Slight correction of Google found code
Illogical thoughts make me ill
Thanks for your reply. I already have gotten it, google is the best friends of mine since I started programming. I still don't get it why I am getting asm version 1.0.0.0 where I see is 1.0.7. I have a installer what does it means project and installer will have two different assembly version. thanks,
-
You can get the version for the application with Application.ProductVersion[^]. For an individual assembly you can use something like
Assembly.GetExecutingAssembly().GetName().Version
which may, or may not give the same result as the first suggestion.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
-
The are two version properties in the AssemblyInfo.cs file... AssemblyVersion - which is returned by your second suggestion (code) AssemblyFileVersion - which is returned by your first suggestion (link)
Illogical thoughts make me ill
Which may, or may not be the same, depending on how they have been set.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
-
Thanks for your reply. I already have gotten it, google is the best friends of mine since I started programming. I still don't get it why I am getting asm version 1.0.0.0 where I see is 1.0.7. I have a installer what does it means project and installer will have two different assembly version. thanks,
In your solution you will find a file called AssemblyInfo.cs in the properties folder. This file will contain an "AssemblyVersion" property which determines the actual version of the assembly (this will be the value you get if you use my suggested code) I don't use VS for installers but I imagine the installer version is simply there as a sort of "release version" value - i.e. it is up to you to pick this, and would probably make sense for you to set it the same as your assembly version (this paragraph is speculation as I said I do not use VS installer wizard thingy) e.g. you may choose to have the following... Assembly Version = 1.2.3.4 Installer Version = 1.2 (don't need to show the rest is you only ever release minor build changes)
Illogical thoughts make me ill
-
Which may, or may not be the same, depending on how they have been set.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.