Nuget Package version with Update-AppveyorBuild

Alex Crome's Avatar

Alex Crome

19 Sep, 2015 04:10 PM

I'm trying to set up my build so that builds from the master branch use the version defined in appveyor.yml, but builds from any other branches add -alphaXXX suffix to the build.

I have the below in my appveyor.yml, and whilst that successfully updates the version number shown for the build in the appveyor UI, the resulting nuget packages do not have the prerelease suffix in them. it looks to me as if this is in turn caused by the assembly info patching task using the original version, not the version set via the powershell script. You can also see an example of this at .

  patch: true
  file: '**\AssemblyInfo.*'
  assembly_version: '{version}'
  assembly_file_version: '{version}'
  assembly_informational_version: '{version}'
- ps: >-
    nuget restore

    if ($env:APPVEYOR_REPO_BRANCH -ne 'master' -or !$env:APPVEYOR_PULL_REQUEST_NUMBER) {
       Update-AppveyorBuild -Version "${env:APPVEYOR_BUILD_VERSION}-alpha${env:APPVEYOR_BUILD_NUMBER}"
  publish_nuget: true
  publish_nuget_symbols: true
  parallel: true
  verbosity: minimal
  1. Support Staff 1 Posted by Feodor Fitsner on 19 Sep, 2015 04:27 PM

    Feodor Fitsner's Avatar

    OK, I see the issue here. Assembly patching occurs before build version updated. To fix that put PS code changing version to "init" section of appveyor.yml

    - Feodor

  2. 2 Posted by Alex Crome on 19 Sep, 2015 04:50 PM

    Alex Crome's Avatar

    Doh, not sure how I missed it. That's fixed that issue.

    I now have a problem that if multiple builds kick off at once, one will fail as a duplicate. I assume this happens because both builds initially start off as version "0.0.3", then the second build runs it's duplicate check before the first build can update it's version.

  3. Support Staff 3 Posted by Feodor Fitsner on 19 Sep, 2015 09:53 PM

    Feodor Fitsner's Avatar

    I don't think it's a good idea to have constant in "version" field of build definition. You should allow it to freely increment each build.

    Instead, you can maintain version in assemblyinfo, extract it, add any suffixes and then update build details. Look at this example to get the idea:

    Another approach is GitVersion:

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:00 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