In my Team Build, I have to run an application that displays a UI. This application is configured to run without user input if we run it with the appropriate command line parameter.
When I attempt to run this locally, it runs without error, but if I run it from the Team Build, the User Interface never displays, and the process just hangs. I can only imagine that this is happening because the TFSBuildServiceHost service is running as a specific user. After doing a little bit of research, I found that services not running as the local service account could not display a User Interface.
With that in mind, I changed my Workflow to include an InvokeProcess activity invoking PsExec and having that run my application with the -i and -s parameters. The idea behind this was that by adding the -s parameter, it would be able to actually display a User Interface. Sadly this did not work. If I add the -h parameter (Runs the executable with its elevated token) I get a strange popup from Interactive Service Detection asking me if I would like to show a message that is trying to be sent开发者_JAVA百科.
Is there a way to always accept a message that is being sent? Does anyone know how to run an application that displays a UI from a Team Build?
You'll need to configure your build service to run in interactive mode. Open the TFS administration console, select Build Configuration, click Properties on your BuildService and select Run build service as: Interactive Process. Of course, you'll need to remain logged onto that machine for the duration.
Have a look at this thread: How can a Windows service execute a GUI application? In short you need to enumerate the active sessions using WTSEnumerateSessions, find the console session and create the process as that user.
精彩评论