Semantic versioning

steven.liekens's Avatar


07 Jun, 2015 01:34 PM


I'd like to know if I can version my assemblies differently based on whether I'm building a tagged commit or not.
* Tag: patch assembly_informational_version as version "1.0.0" to indicate a release
* Not a tag: patch assembly_informational_version as "2.0.0-CI{build}" to indicate pre-release

Where version "1.0.0" and "2.0.0" are just example numbers.
I'm very confused about what my options are for setting the version number dynamically.

  1. 1 Posted by steven.liekens on 07 Jun, 2015 02:57 PM

    steven.liekens's Avatar

    Also, PLEASE tell me there is a better way to test my appveyor.yml changes.

    My current workflow:
    1. make a change to appveyor.yml
    2. push the change
    3. sit and wait for 10 minutes while my build is waiting in a queue
    4. crash with a syntax error on line 66
    5. bang my head against the wall
    6. return to step 1

  2. Support Staff 2 Posted by Feodor Fitsner on 07 Jun, 2015 03:32 PM

    Feodor Fitsner's Avatar

    Hi Steven,

    You can use script to update build version to whatever you like:

    Regarding build queue - we are going to migrate OSS builds from Azure in the coming weeks, so builds will be starting instantly. I can enable Pro trial for your account for now.

  3. 3 Posted by steven.liekens on 07 Jun, 2015 03:35 PM

    steven.liekens's Avatar

    That would be brilliant :)

  4. Support Staff 4 Posted by Feodor Fitsner on 07 Jun, 2015 03:48 PM

    Feodor Fitsner's Avatar

    Enabled. Should be better now.

  5. 5 Posted by steven.liekens on 07 Jun, 2015 04:13 PM

    steven.liekens's Avatar

    Wow... this is a LOT faster! :D

    I discovered that I can set environment variables in the init script

    Set-AppveyorBuildVariable -Name "assembly_version" -Value "1.0"  
    Set-AppveyorBuildVariable -Name "assembly_file_version" -Value ""  
    Set-AppveyorBuildVariable -Name "assembly_informational_version" -Value "1.0.0"

    Now my configuration looks like this

    version: "{build}"  
      patch: true
      file: SharedAssemblyInfo.*
      assembly_version: "$(assembly_version)"
      assembly_file_version: "$(assembly_file_version)"
      assembly_informational_version: "$(assembly_informational_version)"

    I'm not sure if this is a good way to do things, but at least I have something that works now.

  6. Support Staff 6 Posted by Feodor Fitsner on 07 Jun, 2015 04:21 PM

    Feodor Fitsner's Avatar

    Yeah, I think it's pretty good solution.

  7. 7 Posted by steven.liekens on 07 Jun, 2015 07:39 PM

    steven.liekens's Avatar

    Thanks again for the help!

    For future reference, I ended up putting this in my environment section:

      # these variables are common to all jobs
      major: 1
      minor: 0
      patch: 0
      # job 1: create NuGet packages with a pre-release label and push to CI feeds
      - CI_pack: true
      # job 2: create regular packages for manual deployment
      - CI_pack: false

    Then I still had to use a bit of powershell in the init section to get the versioning stuff right.

      - ps: |
          $assembly_version = "$Env:major.0"
          $assembly_file_version = "$Env:major.$Env:minor.$Env:APPVEYOR_BUILD_NUMBER.0"
          If ($Env:CI_pack -eq "true")
              $assembly_informational_version = "$Env:major.$Env:minor.$Env:patch-CI$Env:APPVEYOR_BUILD_NUMBER"
              $assembly_informational_version = "$Env:major.$Env:minor.$Env:patch"
          Set-AppveyorBuildVariable -Name "assembly_version" -Value $assembly_version
          Set-AppveyorBuildVariable -Name "assembly_file_version" -Value $assembly_file_version
          Set-AppveyorBuildVariable -Name "assembly_informational_version" -Value $assembly_informational_version

    Here's an example of the results

  8. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:56 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac