通过TFS版本构建定义在Build Server上运行Windows应用程序

问题描述 投票:0回答:1

使用PowerShell或批处理脚本在构建服务器上运行带有Release Definition的记事本或任何其他Windows应用程序:我尝试了所有已知的命令:

& ′notepad.exe′
Invoke-Expression -Command ′notepad.exe′
Start-Process -FilePath ′notepad.exe′
[System.Diagnostics.Process]::Start(′notepad.exe′)
([wmiclass]″Win32_Process″).Create(′notepad.exe′)
Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList ″notepad.exe″
Invoke-Command -ScriptBlock {& notepad.exe′}
cmd /c ″notepad.exe″

当在服务器上运行时,一切正常(启动记事本或任何其他win应用程序)但当我尝试通过TFS发布定义运行时:命令结束成功但在构建服务器上 - 没有任何反应。

有任何想法吗!!!

powershell tfs tfsbuild build-definition vnext
1个回答
0
投票

如果您的代理以交互模式运行并且所有其他设置都已正确配置,那么答案就是该命令有效。但问题是,一旦构建/发布完成,所有启动的进程都将关闭。所以在检查时你没有看到启动的应用程序。要验证这一点,请使用以下命令添加powershell脚本任务:

Start-Process -FilePath 'C:\Windows\System32\notepad.exe' -wait

运行发布并检查服务器,您应该看到打开记事本。但是,此命令将导致释放永远不会完成,直到您关闭记事本。

© www.soinside.com 2019 - 2024. All rights reserved.