Feature Request: Assembly Informational Version

Steven Thuriot's Avatar

Steven Thuriot

16 Oct, 2013 07:51 AM


At the moment, AppVeyor can automatically update assembly and file version. However, I don't like updating my assembly version each build. I personally like to edit this manually whenever I make a breaking change or implement a new feature. My minor bugfixes etc have the same assembly version but a higher file version.

The issue, however, is that nuget's automatic package build completely ignores the file version attribute. It checks if there's an assemblyinformationalversion attribute first, then checks for an assemblyversion attribute.

It would be a nice feature if I could just update the informational version attribute each build and not touch the others. It would be even more amazing if there were tags available like {AssemblyMajor} and {AssemblyMinor} which contain the original values in the assembly version file. When I then specify the assembly version as in assemblyinfo.cs, I could let appveyor update the informational attribute to {AssemblyMajor}.{AssemblyMinor}.{build}, resulting in e.g. 1.2.15. (Since nuget uses semantic versioning).

It would be useful as well to be able to use these tags in the version field for the appveyor build. I currently set it to 1.2.{build}, but that requires me to update my build template each time I update my assembly info and hope i won't forget to next time.

It really is just a nice to have feature, nothing dealbreaking. Would make my life a lot easier, though!

Kind regards,

  1. Support Staff 1 Posted by Feodor Fitsner on 16 Oct, 2013 04:50 PM

    Feodor Fitsner's Avatar

    OK, that sounds interesting and feels easy to do :)

    Let me recap your idea: Introduce substitution variables for AssemblyVersion and AssemblyFileVersion format fields to preserve original version parts:

    • AssemblyMajor
    • AssemblyMinor
    • AssemblyBuild
    • AssemblyRevision

    so we could have a template like {AssemblyMajor}.{AssemblyMinor}.{build}.{AssemblyRevision} (see attached screenshot). If there is in AssemblyInfo.cs after patching it will be where 47 is AppVeyor build number. Right?

  2. 2 Posted by Steven Thuriot on 17 Oct, 2013 06:23 AM

    Steven Thuriot's Avatar

    Yep, spot on! With the added ability of also patching AssemblyInformationalVersion, if possible. :-)

    This would be interesting since nuget's pack command looks at either assemblyversion or assemblyinformationalversion, ignoring the assemblyfileversion attribute.

    Another variable I've seen a lot of demand for at other CI's, is the commit id. That way you can append it to the assemblyinformationalversion, resulting in something like ( {AssemblyMajor}.{AssemblyMinor}.{build}.{AssemblyRevision}-{CommitId} ). I've noticed you already have this in the custom build scripts section, so I'm not sure if it's doable to get this in the assembly patcher as well. While not really that important for me, I'm sure a lot of people would like!

  3. Support Staff 3 Posted by Feodor Fitsner on 17 Oct, 2013 05:36 PM

    Feodor Fitsner's Avatar

    Sure, will add CommitID too!

    ...and AssemblyInformationalVersion.

  4. 4 Posted by jcw on 10 Mar, 2014 05:53 AM

    jcw's Avatar

    I'm trying to specify the commit id in the AssemblyInformationalVersion field, but I'm not having any success guessing the syntax. So far I've tried:

    {CommitID} {CommitId} {commitid} {commit_id} {repocommit} {repo_commit} {commit} {APPVEYOR_REPO_COMMIT} {repocommitid} {repo_commit}

    Is this supported yet? And if so, what is the token I should use?


  5. Support Staff 5 Posted by Feodor Fitsner on 10 Mar, 2014 06:01 AM

    Feodor Fitsner's Avatar

    Use $(APPVEYOR_REPO_COMMIT). It works for any environment variable.

    - Feodor

  6. 6 Posted by jcw on 10 Mar, 2014 06:31 AM

    jcw's Avatar

    That worked, thanks!

  7. 7 Posted by Steven Thuriot on 13 Mar, 2014 02:38 PM

    Steven Thuriot's Avatar

    Just in case anyone is reading through this and is interested in something similar, for now I've written a pre-build powershell script I've set up in appveyor's build settings. The script can be found in my github repo. (It might need a bit of tweaking to suit your demands.)

    The patching results are similar to this:

    Assembly Version:
    Patched File Version: 0.8.85
    Patched Informational Version: 0.8.85-git320d0e6c
    Patching C:\projects\nova\Nova\Properties\AssemblyInfo.cs
    Patching C:\projects\nova\Nova.Shell\Properties\AssemblyInfo.cs
    Patching C:\projects\nova\Nova.Shell.Library\Properties\AssemblyInfo.cs
    Patching C:\projects\nova\Nova.Test\Properties\AssemblyInfo.cs
    Patching C:\projects\nova\Nova.TestModule\Properties\AssemblyInfo.cs
  8. Support Staff 8 Posted by Feodor Fitsner on 13 Mar, 2014 02:41 PM

    Feodor Fitsner's Avatar

    Thanks for sharing this!

  9. 9 Posted by Ben on 23 Jul, 2015 03:23 PM

    Ben's Avatar

    Feodor, were the substitution variables ever added to allow {AssemblyMajor}.{AssemblyMinor}.{build} to work?

  10. Support Staff 10 Posted by Feodor Fitsner on 23 Jul, 2015 04:32 PM

    Feodor Fitsner's Avatar

    Not yet. However, you can use PowerShell to extract version information from AssemblyInfos and put it to environment variables. Take a look at this example: https://gist.github.com/FeodorFitsner/e038821e3e46e3df0e8f

    This API can be used to set environment variables: http://www.appveyor.com/docs/build-worker-api#set-environment-variable

  11. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:57 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