Hi
I am trying to display productversion in my winform application
What i want is to display version information as major.minor.build (1.0.14). Everytime I recompile I want build to increase by one / or when something changes in the code base and recompile - do not mind which.
I have looked at AssemblyVersion and AssemblyFileVersion and have set those as 1.0.* however it seems to have no effect on application.ProductVersion.
All I get with productversion is 1.0.2131.56354 - does not seem to make a difference what I do but this number stays the same. I have tried this with a simple hello world app.
I am sure I am doing something so stupid, this should not be hard :-)
I am working in C# and .NET 2.0 / VisualStudio 2005
Thanks

Application.ProductVersion
arch_angel81
Application.ProductVersion
or
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
It always say the the version number is 1.0.0.0, the real number shown in my solutions properties is actually 0.3.1.3.
i need help..
Scott Sargent
Bluford
I've found that with the setting as 1.0.* in the AssemblyInfo.cs, the following are set:
Major - set manually
Minor - set manually
Build - incremented by 1 each day
Revision - Changes (how, I don't know) each time you compile
So, in your case (not that I'm suggesting that you do this as practice, more to demonstrate how it works!), with 1.0.2131.56354, if you change the date on your computer, then recompile, you'll get 1.0.2132.85479, where 85479 is some random number. If you want to set the build number to increment each time you build, you'll have to do it manually, or write some code that updates the AssemblyVersionAttribute property.
The following excerpt is from MSDN:
You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). For example,
[assembly:AssemblyVersion("2.3.25.1")]indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as[assembly:AssemblyVersion("1.2.*")]specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as[assembly:AssemblyVersion("1.2.15.*")]specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is random.The link's here: http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemreflectionassemblyversionattributeclasstopic.asp
ricardolowe
To use Assembly version use,
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
Rgds,
Kiran Suthar
Marlon Chen
Try AssemblyInformationalVersionAttribute.
Ex. [assembly: AssemblyInformationalVersion("1.0.1.1")]
Omid Sadeghian
I also want to show the Application's version on the form.
I am using C#.NET 2005.
I am able to display Product version using Application.ProductVersion
but how can i display Application's Assembly version
please reply asap.
Thanks & Rgds,
Kiran