PDA

View Full Version : Build Numbers


garyb@se.rr.com
02-19-2004, 12:32 PM
When I generate a build of my application (which contains several ActiveX Dll's and an ActiveX EXE Server), I want all my build/version information the same through out all the modules.

I am currently using the %BUILD_NUM% variable which works great, but I sometimes forget to set it.

My Builds are versioned by Generation (first Number), Year of existance (second number) and Month & Day as the third set of numbers. So it would look like "2.6.0219" which tells me that it is generation 2, year 6 and was built on Feburary 19th.

What I would like to do is automate the last set of numbers in case I forget to set them so %build_num% variable looks like "2.6.mmdd".

Can anyone suggest a way to do this (perhaps using the VBScripting)?

Thank you....
Gary Bouchard

kinook
02-19-2004, 08:59 PM
Create a project script function based on the system script function vbld_FormatDate, including only the month/day, i.e.:

Function FormatMonthDay()
' returns the current date in the form MMDD

Dim dte

dte = Now
FormatMonthDay = vbld_PadLeft(CStr(Month(dte)), 2, "0") & _
vbld_PadLeft(CStr(Day(dte)), 2, "0")
End Function


Then, the build number value becomes

2.6.[FormatMonthDay()]

garyb@se.rr.com
02-20-2004, 11:06 AM
Thanks for the Info..

I had found something similar yesterday that I tried, and it did mark my version numbers correctly, however I use that same variable ("Build_Num") and automation to create a release in InstallShield Dev. 8 sp2, but the new installshield project becomes;

"2.6.[vbld_FormatMD]" so it appears that the variable does not get the proper information passed to installshield.

Another way perhaps?

kinook
02-20-2004, 11:19 AM
Can you provide a sample of the scenario where the script code in brackets is not being interpreted as such? Thanks.

garyb@se.rr.com
02-20-2004, 11:50 AM
Well, If you can give me an idea what your looking for I can try to.

My version #'s as I mentioned are correct on my exe's and DLL's.

I am using automation to create a new release in Installshield, and I name the release "Build 2.6.####" where ####=MMDD.

I have attacched a MSWord document that has the screenshots and the Automation script to create the project.

Please let me know if you want to see anything else.

Thanks.

kinook
02-20-2004, 12:17 PM
I'm not sure why the script in that macro would not be getting evaluated as script for you (referencing macros containing script expressions in a Run Script step works as expected here).

Here's another way you could approach it:

1) Create a separate macro for the version prefix (i.e. VERSION_PREFIX with a value of 2.6)

2) At the start of the project, add a Set Macro step to create a temporary BUILD_NUM macro with a value of

%VERSION_PREFIX%.[vbld_FormatBldDate]

3) Now when %BUILD_NUM% is referenced later in the project, it won't contain any script references (will already have been evaluated in the Set Macro step).

garyb@se.rr.com
02-20-2004, 12:35 PM
Ok, I followed your instructions, but it is still creates the InstallShield release with "Build 2.6.[vbld_FormatBldDate]"

It seems that the VBScript is not converting the value or something.

kinook
02-20-2004, 01:35 PM
Here is a simple project that uses the technique I described (using the vbld_FormatDate system script function). The last step references %BUILD_NUM% and it displays the expected value of 2.6.20040220. What are you doing differently?

garyb@se.rr.com
02-20-2004, 02:06 PM
Ok,

I guess what I was missing was the project set "Init BuildNum", which I did not have before.

I set that Init Build_Num macro as the first step in the project, and it now appears to be working correctly...

Thank you for your assistance.

Gary