CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    199

    Version # always returns 1.0.0.1

    Using this code:
    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

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Version # always returns 1.0.0.1

    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?

  3. #3
    Join Date
    Sep 2006
    Posts
    199

    Re: Version # always returns 1.0.0.1

    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?

  4. #4
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Version # always returns 1.0.0.1

    Yes you need to use the '*' in the version number for auto-version numbering to work.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  5. #5
    Join Date
    Sep 2006
    Posts
    199

    Re: Version # always returns 1.0.0.1

    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)
    Last edited by purpleflash; May 18th, 2009 at 11:11 AM. Reason: add clarification

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured