Azure DevOps 代理 运行 带有对话框的应用程序

Azure DevOps agent running an application with a dialog box

我正在尝试 运行 National Instruments TestStand Sequence Analyzer 作为 Azure DevOps 构建的一部分,使用 Python 脚本。代理 运行宁作为一项服务。

import subprocess
command = '"%teststand%\Bin\AnalyzerApp.exe" MyAnalyzerProject.tsaproj /analyze /report /save /quit'
exit_code = subprocess.call(command, shell=True)
print(exit_code) # returns the exit status

它在我手动 运行 时有效,但当代理尝试 运行 它时失败:

Unhandled Exception: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
   at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
   at AnalyzerApp.e.a(String A_0, String A_1)
   at NationalInstruments.TestStand.Utility.LaunchTestStandApplicationInNewDomain.HandleLaunchProtectedException(Exception e, String applicationName, DisplayErrorMessageDelegate displayErrorMessage)
   at NationalInstruments.TestStand.Utility.LaunchTestStandApplicationInNewDomain.LaunchProtectedReturnCode(MainEntryPointDelegateWithArgsReturnCode entryPoint, String[] args, String applicationName, DisplayErrorMessageDelegate displayErrorMessage, Boolean parseArgs)
   at AnalyzerApp.e.b(String[] A_0)

我尝试 运行首先使用 cmd 对其进行设置,但根据代理服务用户的不同,它要么卡住,要么抛出错误 -532462766 (0xE0434352) 并将类似的条目写入事件日志。

不需要用户交互:通常对话框会在分析完成后打开和关闭。我在它创建的退出代码和报告文件之后。有没有办法让它发挥作用?

这可以通过 运行 代理以交互方式而不是作为服务来完成。似乎 运行 交互的唯一不利之处是需要自动登录和相关的安全风险。 有关服务与交互的更多信息,请参见 here