View Single Post
  #3  
Old 03-19-2012, 01:30 PM
cholzwarth cholzwarth is online now
Registered User
 
Join Date: 03-19-2010
Posts: 5
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()
Reply With Quote