2012-08-06 220 views
1

我已经花了上周开发Powershell脚本。当我从Powershell窗口启动它时,它现在可以正常工作。但是,我需要从TFS构建中调用该脚本。我试过使用TFS Build InvokeProcess控件的语法Powershell &'script',但似乎没有发生任何事情。所以,我已经回到基础并创建了以下脚本:从命令行执行Powershell

Write-Host " Write-Host line" 
Write-eventlog -logname "Application" -source "BizTalkDeployment" -eventId "01" -entrytype "Information" -message "test" 

我已经将脚本保存为c:\ temp \ ps_test.ps1。我已经打开命令窗口管理和尝试了以下内容:

powershell & 'c:\temp\ps_test.ps1" 

这使命令行下进入PowerShell的模式,我也得到:

PS c:\> 

但没有什么事情发生。

在我的TFS的建设我有一个使用“Powershell的”,其FileName属性的InvokeProcess控制,然后将以下参数的结尾:

String.Format(" ""& '{0}' '{1}' '{2}' '{3}' '{4}' '{5}' '{6}' '{7}' '{8}' '{9}' "" ", DeploymentScriptFileName, IO.Path.GetDirectoryName(DeploymentScriptFileName), "ExecuteBizTalkAppMSI.ps1", "bin\debug\x.Int.MIS-3.0.0.msi", "x.Int.MIS.Deployment.btdfproj", TargetServerPath, "d-vasbiz01", "c:\biztalkdeployment", "C:\Program Files (x86)\x.Int.MIS for BizTalk 2010\3.0", "BTSSvc*MIS*") 

构建脚本运行正常,但InvokeProcess控制似乎做没有什么 - 就像我对命令行的体验一样。

任何人都可以看到我要去哪里错了吗?

回答

3

要么

powershell -file C:\temp\ps_test.ps1 

powershell "&{ <# code here #> }"