Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Build number control

Build number control

Scheduled Pinned Locked Moved C#
questiontutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 Offline
    1 Offline
    12Code
    wrote on last edited by
    #1

    How can i automatically increments the build number in an AssemblyInfo.cs? Any example? using macro or function method?

    Kelvin

    N 1 Reply Last reply
    0
    • 1 12Code

      How can i automatically increments the build number in an AssemblyInfo.cs? Any example? using macro or function method?

      Kelvin

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      MS, he say: The version number has four parts, as follows: <major version>.<minor version>.<build number>.<revision> 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("2.3.25.1")] 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.


      Panic, Chaos, Destruction. My work here is done.

      S 1 Reply Last reply
      0
      • N Nagy Vilmos

        MS, he say: The version number has four parts, as follows: <major version>.<minor version>.<build number>.<revision> 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("2.3.25.1")] 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.


        Panic, Chaos, Destruction. My work here is done.

        S Offline
        S Offline
        Simon P Stevens
        wrote on last edited by
        #3

        williamnw wrote:

        [assembly:AssemblyVersion("1.2.*")]

        I've tried this and I've never been able to get it to work. It always just gives me a version of "1.2.*" on the actual file. Have you got it working williamnw? (Sorry for hijacking your thread 8kelvin) For 8kelvin: There are two other options: 1) The AssemblyInfo[^] task can be used to auto increment the version number by modifying the assemblyinfo.cs file prior to the build being run. You just add an include statement to your project file. 2) There's a task in the MSBuild Community Tasks[^] project that can be used to generate a version number and write it into a generated assemblyinfo.cs file prior to the build running. Again, it just requires some additions to your csproj file (or msbuild script if you use it) To be honest I have problems with both methods in my projects. We have large projects containing multiple assemblies and always end up with references screwed up because one of them is trying to reference versions prior to the number increment, or version numbers getting incremented twice or stupid things like that. This is the one area of our system I'm very unhappy with, but I can't find a decent solution.

        Simon

        1 1 Reply Last reply
        0
        • S Simon P Stevens

          williamnw wrote:

          [assembly:AssemblyVersion("1.2.*")]

          I've tried this and I've never been able to get it to work. It always just gives me a version of "1.2.*" on the actual file. Have you got it working williamnw? (Sorry for hijacking your thread 8kelvin) For 8kelvin: There are two other options: 1) The AssemblyInfo[^] task can be used to auto increment the version number by modifying the assemblyinfo.cs file prior to the build being run. You just add an include statement to your project file. 2) There's a task in the MSBuild Community Tasks[^] project that can be used to generate a version number and write it into a generated assemblyinfo.cs file prior to the build running. Again, it just requires some additions to your csproj file (or msbuild script if you use it) To be honest I have problems with both methods in my projects. We have large projects containing multiple assemblies and always end up with references screwed up because one of them is trying to reference versions prior to the number increment, or version numbers getting incremented twice or stupid things like that. This is the one area of our system I'm very unhappy with, but I can't find a decent solution.

          Simon

          1 Offline
          1 Offline
          12Code
          wrote on last edited by
          #4

          I just got this version file working. Thanks guys. For Simon Stevens,

          Simon Stevens wrote:

          It always just gives me a version of "1.2.*" on the actual file.

          you need to delete [assembly: AssemblyFileVersion("1.0.0.0")] in order to make it work.

          Kelvin

          modified on Friday, March 20, 2009 2:58 AM

          S N 2 Replies Last reply
          0
          • 1 12Code

            I just got this version file working. Thanks guys. For Simon Stevens,

            Simon Stevens wrote:

            It always just gives me a version of "1.2.*" on the actual file.

            you need to delete [assembly: AssemblyFileVersion("1.0.0.0")] in order to make it work.

            Kelvin

            modified on Friday, March 20, 2009 2:58 AM

            S Offline
            S Offline
            Simon P Stevens
            wrote on last edited by
            #5

            Thanks. I'll give it a try.

            Simon

            1 Reply Last reply
            0
            • 1 12Code

              I just got this version file working. Thanks guys. For Simon Stevens,

              Simon Stevens wrote:

              It always just gives me a version of "1.2.*" on the actual file.

              you need to delete [assembly: AssemblyFileVersion("1.0.0.0")] in order to make it work.

              Kelvin

              modified on Friday, March 20, 2009 2:58 AM

              N Offline
              N Offline
              Nagy Vilmos
              wrote on last edited by
              #6

              Saved me answering, thanks!


              Panic, Chaos, Destruction. My work here is done.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups