Click to See Complete Forum and Search --> : Version # always returns 1.0.0.1


purpleflash
May 14th, 2009, 05:35 AM
Using this code:

Assembly myAssembly = Assembly.GetExecutingAssembly();
AssemblyName myAssemblyName = myAssembly.GetName();
textBox2.Text = "Client Version " + myAssemblyName.Version.ToString();

to get he version of my application and set it's value to a textbox.

My app is set up to auto-increment version #'s, and currently is 1.0.0.25

In the debgger, "myAssembly" return the application itself (as is expected) however it always returns 1.0.0.1 for the version. Always.

What's up and what do I need to change?

Using .Net 3.5SP1 on XP

eclipsed4utoo
May 14th, 2009, 06:01 AM
in the Solution Explorer, expand the Properties entry, then open the AssembyInfo file. The last two lines show the assembly version. What do your's say?

purpleflash
May 14th, 2009, 06:30 AM
Hmm:

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

that explains it for sure... but should not this auto-increment since I have auto-increment turned on? Or do I make the change to this:

assembly: AssemblyVersion("1.0.*"

to enable it to auto-increment?

darwen
May 14th, 2009, 12:00 PM
Yes you need to use the '*' in the version number for auto-version numbering to work.

Darwen.

purpleflash
May 16th, 2009, 12:19 PM
Well, the problem then is it versions something like this:

1.0.1256.28472

instead of the 1.0.0.26 (or whatever) it actually is... but in the Properties window it shows the correct version (i.e., 1.0.0.26)