|
#1
|
|||
|
|||
Build only if macro or expression
I have an .ini file that determines how my software deployment is run. One of the parameters in the .ini file is NewMachineConfig.
-- Begin Snippet -- [Global] NewMachineConfig = 0 -- End Snippet -- I have a Log Message that queries the value of this entry. It looks like this: New machine.config = %READ_INI(C:\deploy.ini,Global,NewMachineConfig)% When I run that Log Message I get this output: --------------------Starting Build: 'Deploy.bld'-------------------- Building project step 'Temp'... New machine.config = 0 Build successfully completed. So I am able to read this value properly. I have a SourceSafe step that grabs the machine.config file from SourceSafe, but I only want this file to be copied down if the deployment requires it. So in my SourceSafe step I check the "Build only if macro expression" box and put this in place: %READ_INI(C:\deploy.ini,Global,NewMachineConfig)% is equal to 1 My .ini file will use a binary for yes|no. VBP grabs this file from SourceSafe regardless of the state of that macro. I've tried it with and without surrounding [ ]'s. What have I done wrong? |
#2
|
|||
|
|||
Seems like my upgrade from 4.0 to 5.0 messed me up. After doing a clean install of 5.0 things started working properly.
|
#3
|
|||
|
|||
In general use the Is True test rather than testing for equality for a true/false type test.
A VBScript or JScript true == -1. You happened to use 1 for the same semantic value (no harm in that, some of the best languages use 1 for true internally). Generally any non-zero value can be treated as true and only 0 is treated as false. Your test becomes: %READ_INI(C:\deploy.ini,Global,NewMachineConfig)% is true Note that the [] are not required because this is simply a Macro expansion (albeit a magical one as far as I can see). In this case they don't do any harm either because [0] == 0 && [1] == 1. |
#4
|
|||
|
|||
This all seems to have something to do with my upgrade versus straight install. Version 5 seems to have it fixed.
|
|
|