#1
|
|||
|
|||
Returning variable from PowerShell subroutine
I have a PowerShell subroutine that does string manipulations. I can get the resulting string that I want. Is there a way to set the result to a variable that Visual Build Pro will see when the subrouting exits?
|
#2
|
|||
|
|||
One way to return values from PowerShell to VBP is via global macros.
http://www.kinook.com/VisBuildPro/Ma...ershelltab.htm |
#3
|
|||
|
|||
Doesn't work
What I get when I try this is:
3/19/2012 1:24:58 PM: Building project step 5 - Subroutine Call... 3/19/2012 1:24:58 PM: Building subroutine step 1 - PS_to_VB_Macro... 3/19/2012 1:24:59 PM: Building subroutine step 2 - PowerShell... New-Object : Cannot load COM type VisBuildSvr.Application. At C:\DOCUME~1\CM-PAY~1\LOCALS~1\Temp\VisBAD.tmp.ps1:3 char:18 + $app = New-Object <<<< -com VisBuildSvr.Application You cannot call a method on a null-valued expression. At C:\DOCUME~1\CM-PAY~1\LOCALS~1\Temp\VisBAD.tmp.ps1:6 char:22 + $global = $app.Macros( <<<< 2) You cannot call a method on a null-valued expression. At C:\DOCUME~1\CM-PAY~1\LOCALS~1\Temp\VisBAD.tmp.ps1:12 char:12 + $global.Add( <<<< "XYZ", "val1`tval2") You cannot call a method on a null-valued expression. At C:\DOCUME~1\CM-PAY~1\LOCALS~1\Temp\VisBAD.tmp.ps1:15 char:13 + $global.Save( <<<< ) 3/19/2012 1:25:02 PM: Build successfully completed (elapsed = 00:00:04). The script: # create app object $app = New-Object -com VisBuildSvr.Application # retrieve global macros $global = $app.Macros(2) # WRITE A VALUE TO Visual Build # create/update macro with two values delimited by tab $global.Add("XYZ", "val1`tval2") # save changes to global macros (accessible in the following steps in Visual Build) $global.Save() |
#4
|
|||
|
|||
If you're running v7, you'll need to use VisBuildSvr7.Application (version-independent ProgID is new in v8).
|
#5
|
|||
|
|||
Is there a 32 bit version
The system I am using for builds is a 32 bit system. Is there a 32 bit version of Visual Build Pro 8?
I did get my kluge working - write to a file then read the first line from the file... |
#6
|
|||
|
|||
Yes, the main download at http://www.kinook.com/Download/VisBuildProEval.exe is the 32-bit edition.
|
Tags |
powershell |
Thread Tools | |
Display Modes | Rate This Thread |
|
|