Tags: applicationproductversion, applicationwhat, build, display, hii, major, microsoft, minor, msdn, productversion, software, version, visual, winform
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
Leave a comment...
- 6 Comments
Ex. [assembly: AssemblyInformationalVersion("18.104.22.168")]#1; Sat, 08 Sep 2007 12:08:00 GMT
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("22.214.171.124")]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.#2; Sat, 08 Sep 2007 12:09:00 GMT
- Woodyuk - what did you end up doing?#3; Sat, 08 Sep 2007 12:10:00 GMT
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#4; Sat, 08 Sep 2007 12:11:00 GMT
- I got it,
To use Assembly version use,
Kiran Suthar#5; Sat, 08 Sep 2007 12:12:00 GMT
- This is really bugging me, no matter what i do, wheater it is
It always say the the version number is 126.96.36.199, the real number shown in my solutions properties is actually 0.3.1.3.
i need help..#6; Sat, 08 Sep 2007 12:13:00 GMT