Auto Increment Version in VB 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vul

    #1

    Auto Increment Version in VB 2005

    In VB6 there is Auto Increment check box in Project Properties, which allow
    you have a new version every time you compile the project.
    Is there any easy way to have this feature in VB 2005?
    Some of my blocks of code check and compare versions of EXE and DLLs located
    on the local workstation and the server. So it's very important for me to
    have an incremented number in case the project was rebuilt. It can be done
    manually, of course, but I miss VB6 feature.

    Thank you
    Al


  • Chris Dunaway

    #2
    Re: Auto Increment Version in VB 2005

    vul wrote:
    In VB6 there is Auto Increment check box in Project Properties, which allow
    you have a new version every time you compile the project.
    Is there any easy way to have this feature in VB 2005?
    Some of my blocks of code check and compare versions of EXE and DLLs located
    on the local workstation and the server. So it's very important for me to
    have an incremented number in case the project was rebuilt. It can be done
    manually, of course, but I miss VB6 feature.
    In VB 2005, the version number is incremented when you Publish the app.

    1. Right click on the project and choose Properties
    2. Click on the Publish tab
    3. At the bottom you will see Publish Version and a check box to auto
    increment it.

    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: Auto Increment Version in VB 2005

      You can open the AssemblyInfo.vb file directly and change the following
      lines:

      ' You can specify all the values or you can default the Build and Revision
      Numbers
      ' by using the '*' as shown below:
      ' <Assembly: AssemblyVersion ("1.0.*")>

      <Assembly: AssemblyVersion ("1.0.0.0")>

      The second AssemblyVersion line uses a fixed assembly version, the first
      (that's commented out) uses a "sequencial ". Its sequencial in the fact that
      it encodes the date & time of the build that is set VS started (multiple
      builds within one VS session will normally have the same build & revision
      numbers).

      Alternatively you can set the various parts of the Assembly Version fields
      to * under "Project - xxx Properties - Application - Assembly Information"


      Alternatively there are various "add-ins" available for MSBuild (the
      underlying build engine in VB 2005) that will autoincrement the assembly
      version, such as:




      --
      Hope this helps
      Jay B. Harlow [MVP - Outlook]
      ..NET Application Architect, Enthusiast, & Evangelist
      T.S. Bradley - http://www.tsbradley.net


      "vul" <aaa@optonline. netwrote in message
      news:e40BbBOtGH A.1512@TK2MSFTN GP03.phx.gbl...
      | In VB6 there is Auto Increment check box in Project Properties, which
      allow
      | you have a new version every time you compile the project.
      | Is there any easy way to have this feature in VB 2005?
      | Some of my blocks of code check and compare versions of EXE and DLLs
      located
      | on the local workstation and the server. So it's very important for me to
      | have an incremented number in case the project was rebuilt. It can be done
      | manually, of course, but I miss VB6 feature.
      |
      | Thank you
      | Al
      |
      |


      Comment

      • Chris Dunaway

        #4
        Re: Auto Increment Version in VB 2005

        Jay B. Harlow [MVP - Outlook] wrote:
        You can open the AssemblyInfo.vb file directly and change the following
        lines:
        >
        ' You can specify all the values or you can default the Build and Revision
        Numbers
        ' by using the '*' as shown below:
        ' <Assembly: AssemblyVersion ("1.0.*")>
        >
        Hi Jay

        In Jeffry Richter's book, "Applied Microsoft .Net Framework
        Programming", Microsoft Press, 2002, he says not to use that feature:

        Quote:

        The CSC.exe and AL.exe tools support the ability to automatically
        increment the assembly version number with each build. This feature is
        a bug and shouldn't be used because changing the assembly version
        number will break any assemblies that reference this assembly. The
        AssemblyInfo.cs file that Visual Studio .Net automatically creates for
        you when you create a new project is in error: it sets the
        AssemblyVersion attribute so that its major and minor parts are 1.0 and
        that the build and revision parts are automatically updated by the
        compiler. You should definitely modify this file and hard-code all
        four parts of the assembly version number.

        End Quote

        Do you know if the issues he refers to still exist in VS2005?

        Just curious.

        Chris

        Comment

        • Al

          #5
          Re: Auto Increment Version in VB 2005

          Chris,
          thank you.
          I'm working on Class Library project (DLL) in VB 2005.
          DLL is going to be on the server and VB6 client will compare the versions of
          DLL on the workstation and on the server, in case they are different the
          workstation DLL will be replaced with the server instance.
          Of course I can manually increment the version number, but it's an extra
          step, and being spoiled by VB6 auto increment, it's possible to forget to do
          that.
          Unfortunately I do not see Publish Tab in Project properties for Class
          Library project. I have that tab for Wondows Application project though.

          Al

          "Chris Dunaway" <dunawayc@gmail .comwrote in message
          news:1154438955 .657927.177950@ h48g2000cwc.goo glegroups.com.. .
          vul wrote:
          >In VB6 there is Auto Increment check box in Project Properties, which
          >allow
          >you have a new version every time you compile the project.
          >Is there any easy way to have this feature in VB 2005?
          >Some of my blocks of code check and compare versions of EXE and DLLs
          >located
          >on the local workstation and the server. So it's very important for me to
          >have an incremented number in case the project was rebuilt. It can be
          >done
          >manually, of course, but I miss VB6 feature.
          >
          In VB 2005, the version number is incremented when you Publish the app.
          >
          1. Right click on the project and choose Properties
          2. Click on the Publish tab
          3. At the bottom you will see Publish Version and a check box to auto
          increment it.
          >

          Comment

          • Jay B. Harlow [MVP - Outlook]

            #6
            Re: Auto Increment Version in VB 2005

            Chris,
            I agree with his statement 99%, especially when you don't rebuild all
            related projects at the same time. I wouldn't say its a bug as much as
            intended behavior! You want the referencing assemblies to break if you make
            a "material" changes aka a breaking change. The compile is just assuming
            that *ALL* changes are "material" changes.

            I use the feature extensively as I normally have all related projects in a
            single solution & rebuild all at the same time... Also with refactoring its
            not uncommon for me to very easily introduce a material change. Ergo I'm
            assuming that *ALL* my changes are "material" changes.

            FWIW:
            <quote>
            | You should definitely modify this file and hard-code all
            | four parts of the assembly version number.
            </quote>
            Is also a bug waiting to happen, if you make a "material" change in one
            assembly & forget to increment the version #, then the assembly will
            continue to load & run. If the "material" change is such that it is rarely
            executed, it could be a while before the change causes your program to
            crash.

            | Do you know if the issues he refers to still exist in VS2005?
            Yes.



            --
            Hope this helps
            Jay B. Harlow [MVP - Outlook]
            ..NET Application Architect, Enthusiast, & Evangelist
            T.S. Bradley - http://www.tsbradley.net


            "Chris Dunaway" <dunawayc@gmail .comwrote in message
            news:1154443904 .376693.165660@ 75g2000cwc.goog legroups.com...
            | Jay B. Harlow [MVP - Outlook] wrote:
            | You can open the AssemblyInfo.vb file directly and change the following
            | lines:
            | >
            | ' You can specify all the values or you can default the Build and
            Revision
            | Numbers
            | ' by using the '*' as shown below:
            | ' <Assembly: AssemblyVersion ("1.0.*")>
            | >
            |
            | Hi Jay
            |
            | In Jeffry Richter's book, "Applied Microsoft .Net Framework
            | Programming", Microsoft Press, 2002, he says not to use that feature:
            |
            | Quote:
            |
            | The CSC.exe and AL.exe tools support the ability to automatically
            | increment the assembly version number with each build. This feature is
            | a bug and shouldn't be used because changing the assembly version
            | number will break any assemblies that reference this assembly. The
            | AssemblyInfo.cs file that Visual Studio .Net automatically creates for
            | you when you create a new project is in error: it sets the
            | AssemblyVersion attribute so that its major and minor parts are 1.0 and
            | that the build and revision parts are automatically updated by the
            | compiler. You should definitely modify this file and hard-code all
            | four parts of the assembly version number.
            |
            | End Quote
            |
            | Do you know if the issues he refers to still exist in VS2005?
            |
            | Just curious.
            |
            | Chris
            |


            Comment

            Working...