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?

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?
Comments are currently closed for this discussion. You can start a new one.
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
#1 Posted by Feodor Fitsner Support staff on 02 Jan, 2016 11:13 PM
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 Posted by jezz.santos on 05 Jan, 2016 08:16 AM
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
AssemblyInformationVersionattribute, 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_NUMBERto the end of that (with another dot), then set that as the AVAPPVEYOR_BUILD_VERSIONnumber.Then I am going to use this to set the AssemblyFileVersion attribute:
#3 Posted by jezz.santos on 06 Jan, 2016 10:29 PM
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 Posted by Feodor Fitsner Support staff on 06 Jan, 2016 11:07 PM
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
installphase when sources are there: https://gist.github.com/FeodorFitsner/82dad08650d72268e48d#5 Posted by jezz.santos on 07 Jan, 2016 12:11 AM
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 Posted by jezz.santos on 10 Jan, 2016 04:47 AM
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
$versioninto theAssemblyFileVersionattribute, 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 Posted by Feodor Fitsner Support staff on 10 Jan, 2016 07:12 AM
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
jezz.santos closed this discussion on 11 Jan, 2016 08:14 AM.