2

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.

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?

2 Answers2

1

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.

Jim Lamb
  • 25,355
  • 6
  • 42
  • 48
  • This was exactly what I was looking for, thank you sir. I ended up adding a new value in the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run directory that pointed to the build service's executable. ("C:\Program Files\Microsoft Team Foundation Server 2010\Tools\TFSBuildServiceHost.exe" in my case) This enabled an automatic log on so I wouldn't have to repeatedly enter my password anytime someone logged on the build agent. –  Aug 04 '11 at 14:50
-1

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.

Community
  • 1
  • 1
Jacob Seleznev
  • 8,013
  • 3
  • 24
  • 34