Team System Developer Center > Visual Studio Team System Forums > Team Foundation Server - Build Automation > Post Build Event console app executable runs fine in IDE build, but fails to run in Team Build
Ask a questionAsk a question
 

QuestionPost Build Event console app executable runs fine in IDE build, but fails to run in Team Build

  • Monday, September 28, 2009 8:08 PMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dear Team Builders

    I'm Team Building a Solution with three Projects.  Most of the code is unmanaged C++.  The third project "HFTGTest" to build produces a console application "hftgtest.exe" (and the library it is dependent on LpsTktHFT.dll has been produced earlier by the first build of the three projects).

    In a post build step for HFTGTest the cmd line calls for the execution of "hftgtest.exe" .  This works fine in a local VS2008 IDE build, and hftgtest.exe's output is presented in the output window for the build.  Hftgtest.exe also runs fine on the build server machine if run from a Windows logon (i.e. in the Windows visual environment and not under the Team Build umbrella.)  It fails to execute under Team Build.

    The MSBuild output shows no error for this post build event execution attempt.

    I believe this may be happending either because somehow user tfsservice (ie. Team Build) doesn't have execute access to the ..binaries\win32\Release\ where the target is stored (which seems unlikely since tfsservice built the targets and placed them there.)
    OR
    because the IDE is a visual environment that naturally puts up a command window in which to run this console app, but that Team Build is running on the Build server in a non-interactive no-visuals environment (i.e. as a Windows Service) and fails when asked to execute a console app (but this seems unlikely too because hftgtest.exe can be run in a non-visual mode from as a scheduled task (schtasks) (as long as the schtask invocation is not from Team Build)

    I'm only guessing about these two possible sources for the error, and am looking for more input.

    Any ideas?

    Thanks,

    Peter Schwenn

    notes:
    1) My workstation is a PC running 32-bit XP SP3 with VS2008, and my build server is running 64-bit Windows Server 2003 with Team Build 2008, and the TFS server is TFS2008.
    2) Hftgtest.exe 's purpose is to run unit tests (not standard unit tests in the VS2008 build framework but ones I've written myself) on the methods of the first built of this solution's three projects.
    3) I have verified that simple .bat's (file copies and such) run fine if substituted as the post build event in question
    4) If I use "...hftgtest.exe > test.txt" as my post build event cmd line, test.txt is created but empty which verifies that Team Build has "tried" to execute hftgtest.exe
    5) I have tried the post build event cmd line with and without a prefacing cmd "...", and with start /b "..."

    schwenn
    • Edited byschwenn Monday, September 28, 2009 8:09 PMclarity
    •  

All Replies

  • Monday, September 28, 2009 8:25 PMMike Fourie Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    what happens if you run the build in interactive mode. details here: http://ozgrant.com/2008/02/28/running-an-interactive-team-build-2008-agent/
    • Marked As Answer byRuiz YiModeratorFriday, October 02, 2009 4:53 AM
    • Unmarked As Answer byschwenn Thursday, October 08, 2009 4:03 PM
    •  
  • Tuesday, September 29, 2009 2:45 AMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you for the suggestion.  I will give that a try (I cannot do it right away tho.)
    schwenn
  • Wednesday, September 30, 2009 3:10 AMRuiz YiModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi schwenn,

    Is this issue fixed?

    Best Regards,
    Ruiz
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi
  • Monday, October 05, 2009 3:04 PMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ruiz,

    Not yet.  I'm going to try out the Interactive Build-Agent idea today and will post back here.

    Peter Schwenn
    schwenn
  • Monday, October 05, 2009 8:14 PMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Ruiz, and Mike Fourie,

    The suggestion of using an interactive build agent has been useful in verifying that Team Build will not run my unit tests for unmanaged code BECAUSE my test app is a console app and thus requires a windowing environment to put up the command window.  Using the Interactive Build Agent I am able to get my tests to run.

    Unfortunately, tho this verifies the cause of my problem, I still have to do something to suppress any console output and any request for a command window from my application -- i.e. to convert it to be a no-GUI/no-Console app.  I had thought of converting it to be a Windows Service but then I don't know how to get Team Build to launch it.

    What would be helpful is knowing what triggers the instantiation of a Command Window under Windows.  Is it the first output to STDOUT or STDERR which is directed to CON:, or is there an explicit call in the usual console app that asks for a command window?  (I should know what the test app does exactly but it was inherited from someone long gone who used the Console App Wizard in VS to start its life as a project.)

    Thank you for you help Ruiz and Mike Fourie

    schwenn
  • Wednesday, October 07, 2009 6:19 PMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Still no luck on suppressing command window in my post build event.

    What MSDN forum would be appropriate for finding out what IS the trigger or condition or library or ... that causes my build event task to cause a command window to be popped up.  (I.e. what is it that makes a Console App a Console App?)

    Peter Schwenn

    p.s. I'm a little bit surprised this is not a more common problem (a problem often raised on this forum).  It would seem to me that many post build events would be either Windows apps or WinForm apps or Console apps and therefore fail to run under Team Build because they demand a visible windowing environment.
    schwenn
  • Thursday, October 22, 2009 7:48 AMLasseJ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We're running a lot of command line applications from our Team Build without any problem, we've just specified them to run in the tfsbuild.proj file after the solution were compiled.

    Also if you're not able to run them directly you could always create a team build add on which runs the application.

    Sorry I don't have any example code to run the application or how to create a team build add on right now. But I think I could find it later if you'd like.

    // Lasse
  • Friday, November 06, 2009 4:08 PMschwenn Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Lasse,

    Thanks for the info, that seems very promising and I'd like to try it out, -- tho I'm not clear about how to "run in the tfsbuild.proj file....".

    What elements or sections or ??? in the tfsbuild.proj file did you modify or extend in order to run your command line applications "in the tfsbuild.proj file after the solution was compiled" ?

    An example piece of one of your tfsbuild.proj files, or a pointer to relevant documentation would be much appreciated.

    Thank you,

    Peter Schwenn
    schwenn