View Single Post
  #2  
Old 12-15-2004, 05:34 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,013
When you have macros that are marked to update environment variables, you don't need to (and actually probably should not) pass them as parameters to the child project; when the build starts, all existing macros that are marked to update env vars are updated in the current process env block, which is (recursively) inherited by any processes started by VBP (and are also available as system macros in the child VBP instance if 'Tools | Application Options | Macros | Include env vars in system macros' is checked).

So, when the parent build starts, the env block will be updated with the current project macro values. The child VBP process will inherit those env values, as will the batch file that is invoked by the child project.

I made a simple test here (attached) and it produces the expected output when built via the GUI or console app:

12/15/2004 4:17:09 PM: --------------------Starting Build: 'C:\Temp\batchparent.bld'--------------------
12/15/2004 4:17:09 PM: Building project step 'Project steps'...
12/15/2004 4:17:09 PM: Building project step 'call child'...
12/15/2004 4:17:09 PM: --------------------Starting Build: 'C:\Temp\batchchild.bld'--------------------
12/15/2004 4:17:09 PM: Building project step 'Project steps'...
12/15/2004 4:17:10 PM: Building project step 'call batch file'...
VAR1 = 12/15/2004 4:17:09 PM
VAR2 = test var2 12/15/2004 4:17:09 PM


I'm not sure what could be causing VisBuildCmd to have different behavior in your case (even if you are passing the macro values to the child project, since this won't affect the env block). First take a look at the attached sample and see if it works correctly for you. If it does, you should be able to tweak your project to match. Otherwise, we may need to investgiate a little further to see what's different about your configuration.
Attached Files
File Type: zip batchtest.zip (863 Bytes, 1004 views)
Reply With Quote