|
#1
|
|||
|
|||
Dynamic Build does *nothing*
I am having problrms trying to run a dynamic build from a Run Script. I couldn't find any sample code that did what I want, so guessed how to do it; I am most likely doing something wrong. The relevant chunk of the Run Script (VBScript) looks like:
Dim objBld, objApp, objMacro Set objBld = CreateObject("VisBuildSvr.Builder") Set objApp = CreateObject("VisBuildSvr.Application") objBld.Initialize objApp objApp.Project.Load "%PROJDIR%\BuildVB6.bld" Set objMacro = objApp.Project.Macros.Add("PROJFILE", ProjFile) Set objMacro = objApp.Project.Macros.Add("BLDVERSION", "1.2.3") Rslt = objBld.SyncBuild if Rslt <> 0 then msgbox "Error - Build of " & ProjFile & " returned " & Rslt & "!", vbOKOnly, "Parser.bld" end if The called VBP project file ("%PROJDIR%\BuildVB6.bld") contains: <?xml version='1.0'?> <project version='5'> <step action='Make VB6' type='0'> <Attr type='11'>-1</Attr> <BinCompat type='11'>-1</BinCompat> <Filename>%PROJFILE%</Filename> <IncrReason type='11'>-1</IncrReason> <Version>%BLDVERSION%</Version> <VersionSel type='3'>2</VersionSel> <ignorefail type='11'>-1</ignorefail> <indent type='3'>2</indent> <name>VB6 build</name> </step> </project> The facts as known: 1) BuildVB6.bld is being read: if I hide it I get a "can't find it" error. 2) objBld.SyncBuild always returns 0 and produces no log output. 3) objBld.SyncBuild always runs *very* quickly. Can someone suggest what is wrong? Thanks in advance - Michael |
#2
|
|||
|
|||
It is hard to say for sure, but it appears that PROJFILE is a macro in the calling Build step, but you don't have % % around it, so a new variable "ProjFile" is being created (containing an empty string) which is assigned to this macro in the secondary instance executing BuildVB6.bld.
Try changing line 6 to be: objApp.Project.Macros.Add "PROJFILE", %ProjFile% or objApp.Project.Macros.Add "PROJFILE", "%ProjFile%" if this macro can contain spaces and isn't already double-quoted |
#3
|
|||
|
|||
Thanks for the reply kevina.
I think my example was confusing. ProjFile is a VBScript variable. For clarity, my example code should have read: Set objMacro = objApp.Project.Macros.Add("PROJFILE", "c:\build\foo.vbp") rather than: Set objMacro = objApp.Project.Macros.Add("PROJFILE", ProjFile) Rather than debugging my code, perhaps what would be most useful for me is example VBScript source using the Project.Load method to run the VS6 or VS.NET IDE via a generated or pre-packaged {VBP}.bld file. I couldn't find anything like that in the help, sample code or on the VBP website. |
#4
|
|||
|
|||
I'm not entirely clear what is wrong with your sample script, but I put together a quick sample that does what it seems you need to do. Put all the provided files in a folder, and run Test1.bld. Test2.bld will be dynamically instantiated, and it will in turn compile Test.vbp (and the log from the second build will be added to the log of the parent build).
Hope that helps. |
Thread Tools | |
Display Modes | Rate This Thread |
|
|