1

I am using VS2013. I am running a build definition based on the TfvcTemplate.12.xaml build template on a local build server. I am trying to pass the value of a Visual Studio macro to a pre-test PowerShell 3.0 script.

My script currently only logs the value passed. It looks like

Param(
 [string]$MyParam
)
$MyParam | Out-File -FilePath 'C:\ProgramData\Company\PS.log' -Append

The Pre-test script arguments field contains -MyParam $(ProjectDir) I expected the ProjectDir macro would be translated to the actual directory, but the literal string $(ProjectDir) is logged.

My question is: how can I use the value of the VS macro variables in my pre-test script?

Thanks, PC

pcoveney
  • 11
  • 1
  • Try -MyParam '$(ProjectDir)'. – Nathan Rice Mar 10 '15 at 20:17
  • Making this change causes '$(ProjectDir)' to be logged--that is, including the single-quotes. FWIW, I don't believe this is a PowerShell issue, it's a TFS Process template issue. I need to get TFS Build to expand the $(ProjectDir) (e.g.) variable before passing the value down to the script. I don't think it's even possible for PS to expand this variable; I've logged the env: variables, and none of the build macros/variables appear. – pcoveney Mar 12 '15 at 13:29

0 Answers0