I am doing builds of several components and I want to set the Major, Minor, and Build version numbers, but leave the revision number alone (leave it at whatever the developer had it set to). How can I do this? I tried simply not putting a number in the Revision field of the Action Item, but after running FinalBuilder I look at AssemblyInfo.cs and see the version has been set to “x.y.z.” - the revision number is blank, not even 0 or anything. I was hoping that giving a blank value would be the trigger for the value to be left as-is.
It wouldn’t be hard for me to write a script to edit the AssemblyInfo.cs files myself before doing the build, but I just wanted to know if FB has this built-in, and how does everyone else do it?
Hi Mike,
You can use the AssemblyInfo Updater action to do this. You need to point it to your AssemblyInfo.cs file, and then you can control which properties get updated using the OnProcessEntry script event.
hth.
Tate,
Thanks for the help. I got it going by using a File Iterator to find all the AssemblInfo.cs files, then using a Text Replace in Regular Expression mode to find only the M.m.B. text, then replacing it and leaving the rest alone.
I’m having a problem with this now.
Originally I was wanting to change the Major, Minor, and Build numbers and leave the revision alone, so I was using the regular expression method I mentioned.
Now I want to leave Major, Minor, and Revision alone and just change the Build number. I couldn’t figure out how to do this with regular expressions, so I did a script as Tate suggested.
Before I run this script, I set variable FB_TempVar to be the build number that I want to use. Then I have this script in the OnProcessEntry sub for the AssemblyInfo Updater:<br>dim aVer<br>if (EntryName="AssemblyVersion") or (EntryName="AssemblyFileVersion") then<br> aVer=split(EntryValue,".")<br> if ubound(aVer)=3 then<br> EntryValue=aVer(0) & "." & aVer(1) & "." & cstr(FB_TempVar) & "." & aVer(3)<br> end if<br>End If<br>
This seems to have an issue with a line that looks like this:
[assembly: AssemblyVersion( “1.0.985.2” )]
It comes out with the spaces removed (no big deal) and an extra parenthesis:
[assembly: AssemblyVersion(“1.0.985.2”))]
The log file doesn’t show anything that would indicate a problem:
Processing File : W:\DCT 1.0\Common\Libraries\Presentation\BallyTech.Systems.Forms.Utility\Properties\AssemblyInfo.cs
Setting Attribute : AssemblyVersion Value : "1.0.985.2"
Setting Attribute : AssemblyFileVersion Value : "1.0.985.2"
Is this a bug or what?
OK I found another way to do it. Going back to Text Replace Action and using a regular expression to find the line:
[assembly: *Assembly(File)*Version( *"[0-9]+.[0-9]+.[0-9]+.[0-9]+" *)]
And then a script in OnFindText:
Dim aVer
aVer=split(FoundText,".")
If UBound(aVer)=3 Then
ReplaceText=aVer(0) & “.” & aVer(1) & “.” & cstr(789) & “.” & aVer(3)
End If
Oops, that last line where it says " cstr(789)" was my test value. It should have the build number variable there.