Read AV Build Number from source file

Is it possible to set the AV build version by reading it from an AssemblyInfo.cs file (from repo at the solution level)?

If so, any examples? When, how?

  1. Yes, that's possible. Take a look at this thread: http://help.appveyor.com/discussions/problems/3076-nuget-package-version-with-update-appveyorbuild
    Example from that thread how to read version from AssemblyInfo.cs: https://gist.github.com/FeodorFitsner/e038821e3e46e3df0e8f

    -Feodor

  2. Hey Feodor,

    I am going to need your help here. I am not so good with ps commands.
    Can you help me with the PS that will go in my YML file

    This is what I want to do:
    1. First, I want to read the string value from the AssemblyInformationVersion attribute, which is in my GlobalAssemblyInfo.cs file which lives at the path src\GlobalAssemblyInfo. (It is a 2 dot version number)
    2. Then I want to add the AV build number APPVEYOR_BUILD_NUMBER to the end of that (with another dot), then set that as the AV APPVEYOR_BUILD_VERSION number.

    Then I am going to use this to set the AssemblyFileVersion attribute:

    assembly_info:
      patch: true
      file: src\GlobalAssemblyInfo.cs
      assembly_file_version: '{version}'
    
  3. Hi Feodor, sorry I know you are busy, just let me know if you are able to help me on this one, or if you can't?

  4. Hi Jezz,

    Sure, I've been working on the script. I didn't realize from the start that there is only one "global" assemblyinfo file (I guess it's linked to all projects) and you don't have to use built-in assembly patcher at all. Instead, you can do all the job in a simple PowerShell called on install phase when sources are there: https://gist.github.com/FeodorFitsner/82dad08650d72268e48d

  5. Hey Feodor,

    thank you, thank you, thank you!!!

    Yes, just one GlobalAssemblyInfo.cs in the repo, and linked into every project.

    Love your work, saved me.

  6. Hey Feodor,

    I used almost all the script you wrote, except the bit that writes back the version number. The bit that sets the version of the build is great! thanks.

    I wanted to write the final $version into the AssemblyFileVersion attribute, not the 'AssemblyInformationalVersion` attribute.
    And then, I may want to make a commit on that to save it back to the github repo, with a specific commit message.

    Is that kind of stuff easy?

  7. You can easily adopt regex in the script to update AssemblyFileVersion.

    For pushing changes into repository take a look at this article: http://www.appveyor.com/docs/how-to/git-push

  8. jezz.santos closed this discussion on 11 Jan, 2016 08:14 AM.

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

Keyboard shortcuts

Generic

? 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