#1
|
|||
|
|||
Command line usage
Can someone supply a working sample where multiple macros are defined from the command line. I have not been able to get this working.
|
#2
|
|||
|
|||
invoke the provided .bld file from this command line:
visbuildpro "TEMPMACRO1=T1" "TEMPMACRO2=T2" "TEMPMACRO3=T3" /d /b "c:\path\to\multiplemacros.bld" See the following for more details: http://www.visualbuild.com/Manual/?command_linegui.htm http://www.visualbuild.com/Manual/?consoleapp.htm You can also have VBP generate the command-line for you by adding some temporary macros and then choosing Tools | Create Scheduled Task on the menu, then copying the command from the task and deleting the task: http://www.visualbuild.com/Manual/?s...eautomatic.htm |
#3
|
|||
|
|||
Thank You.
It ended up that the problem was Word formatting of the quotes. Thanks for reinforcing that the parameters were as expected. Wally |
#4
|
|||
|
|||
What if I want to have Project macros that are overridden by the command line? Is that possible? Using temporaries means that I can't run using the GUI without defining the temporaries.
Do the values passed on the command line equate to temporary macros? If so do folks just tend to create some steps to check for the temporaries and initialize them to defaults if not found? |
#5
|
|||
|
|||
VBP implements an order of precedence (temporary, project, global, system [highest to lowest]) when macros are referenced like %MACRO_NAME% within step fields (or like Application.ExpandMacrosAndScript("%MACRO_NAME%") within script code), and overriding a project macro (which defines the default) with a temporary macro (on the command-line) is an ideal use of this feature. See the following help topics/samples for more details:
http://www.visualbuild.com/Manual/?macrostab.htm http://www.visualbuild.com/Manual/?hints.htm (3rd from last bullet) http://www.visualbuild.com/Manual/?v...dprosample.htm |
#6
|
|||
|
|||
Right I realized I meant to ask a related question. Is it possible to use environment variables to the same effect? IOW rather than having to customize the command line can I simply set some environment variables (say from within a batch file) and have those override Project macros which define the default.
My recollection is that env vars are considered to be System macros and are thus lower priority than System macros. |
#7
|
|||
|
|||
Alternatively if the temp macros could be read from a text file that would be handy. I have something like 20 macros I would like to define in order to parameterize my builds. Specifying them all on command line is a little cumbersome.
|
#8
|
|||
|
|||
Regarding environment variables, you could add a Run Script step at the beginning of the project to iterate over all environment variables, storing them in temporary macros. Although you probably don't want to do this for all variables, so you'd need to filter the list in some way. In VBScript, something like this:
Set shell = CreateObject("WScript.Shell") Set env = shell.Environment("PROCESS") For Each var In env ' logic here to parse the name/value out and ' determine if this variable should be processed vbld_TempMacros.Add name, val Next Regarding reading from a file, you could again use a Run Script step to iterate over the file contents and assign the values to temporary macros. Something like the attached sample. |
#9
|
|||
|
|||
Quote:
|
#10
|
|||
|
|||
Only temporary macros can be created on the command-line. You could add a Run Script step to create/update a project macro for each temporary macro. See the attached sample.
But normally you would not want to modify a project within a build, because Visual Build will prompt for changes on exit. http://www.kinook.com/Forum/showthread.php?t=245 |
|
|