Results 1 to 13 of 13

Thread: Build Number in Version

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    16

    Build Number in Version

    The full version number consists of a Major Version, Minor Version. Build Number, and a Revision Number.

    Is there any way to have the Build Number automatically incremented each time the application is rebuilt?

    Right now, the only alternative I am aware of is to manually change the AssemblyVersion in AssemblyInfo.vb

    I would prefer an automatic method if one is possible.

    Thanks,
    Dave

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    I'd like to know this also, I haven't stumbled across a way to do this in the docs.

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    In the assembly.vb file, in the version section put <1.*.*.*>. (not sure if thats the correct syntax) That should do the trick.
    Dont gain the world and lose your soul

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Oh hey, look at that, it's already there. My main project's build information is "1.0.1218.13913". I didn't realize it stuck it into the .EXE. Is there a way to check build number at development, instead of after the build -> File -> Properties -> Version?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    16
    I'm already using the syntax of 1.2.*, and that does NOT increment the build number automatically.

    Anybody else have any ideas?

    Thanks,
    Dave

  6. #6
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    I think it only does if you have it like this 1.*.*.*. I'll check when I get home.
    Dont gain the world and lose your soul

  7. #7
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Ok I tried this
    VB Code:
    1. <Assembly: AssemblyVersion("1.1.*")>
    and it worked.

    BTW I'm using VS.NET 2003, so maybe this was just included.
    Dont gain the world and lose your soul

  8. #8
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Works in 2002 also, my app is now version 1.1.1218.30337! Whee!

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    16
    You seem to be describing a single build. But does this mean that you are really getting incremental changes in the build number?

    Rebuild your program again and again. I think you will find that the build number does not get automatically incremented. At least its not for me.

    Let me know what you experience.
    Dave

  10. #10
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    What actually makes the version number change on my machine is exiting and restarting the IDE, and then rebuilding. Multiple rebuilds even with profound code changes (commenting out large chunks of code) did not make the version number in the .EXE change, but quit and re-enter the environment and rebuild and the version changes. And by the way the increment isn't 1 for 1 build, it's on some pattern I can't figure out. ^_^

    According to the docs:
    ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconVersionNumberingChangesInVisualBasicNET.htm
    "In Visual Basic .NET, the version number properties are replaced by the AssemblyVersion attribute, which has four parts: Major, Minor, Revision, and Build. For the above example, the resulting version number would be 1.2.3.x, where x is a build number that is incremented each time the assembly is built."

    ... the above does not seem to be accurate, at least not for me.

  11. #11
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Well I just tried this in C# and everytime I build my project my build number changes.
    Dont gain the world and lose your soul

  12. #12

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    16
    To Slow_Learner:

    There seems to be some discrepancy in the documentation. Contrary to the doc you cited, the AssemblyInfo.vb comments would seem to indicate a different order to the version number, namely Major/Minor/Build/Revision. Note that your documentation switches the order of the last two pieces.

    Further, the VB help under Version Class relates the following:
    Version numbers consist of two to four components: major, minor, build, and revision. Components major and minor are required. Components build and revision are optional, but the revision component is only optional if the build component is not defined. All defined components must be decimal integers greater than 0. Metadata restricts the major, minor, build, and revision components to a maximum value of MaxValue- 1.
    The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'):

    The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'):
    major.minor[.build[.revision]]


    So, Slow_Learner, its your revision number that is changing, not the build number. And I agree that it is some unknown increment. Although it seems to be time-related. Early in the day, it has a low number, which is incremented throughout the day. The next morning, it reverts back to a low number again.

  13. #13
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    This is troubling. I created brand new C# project, and when rebuild (even without modifying) the last set of digits in version information changes. Odd also is that it didn't start out as 1.0.0.0, this was the first version info:

    1.0.1219.27678

    and again, the numbers do not go up 1 for 1 build.

    I created a new VB project, and it behaves differently - version information does not go up even if you delete the ./bin and ./obj directories from your project (to "force" a complete rebuild in case some shortcut was being taken), or if you make substantial code changes. Very strange!

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