none
TFS 2010 - how to execute a batch file after build

    Question

  • hi guys, a little help please, can someone point me to the right direction on how to run a script (batch file or anything) after Manual or nightly builds. We are currently at Team Foundation server 2010 Beta 2 and going to RC. I have read many post regarding the way i want it but it's all about TFS 2008, is there a step by step guide on how i can achieve my goal. My plan is is to:

    1. After Manual/Nightly Build
    2. run batch file that will copy the latest build version to the development web directory


    Regards
    Arnel Gracela
    Thursday, March 04, 2010 7:54 AM

Answers

  • Hi jakob,

    I tried your suggestion and put the CopyDirectory activity after "Try Compile, Test and Associate" activity and its perfectly working, btw, can anybody direct me on how to automate publishing/deploying web contents from development to staging(external server) then to production? Does it use CMS/Content Management System? I can automate putting a zip copy of the web contents to staging through FTP, only problem is how can i extract and put it to the website directory. I'm thinking of a Web based File Manager with zip/unzip support but i can't find a .net version.

    Regards
    Arnel Gracela
    • Marked as answer by arnelgracela Wednesday, March 10, 2010 7:55 AM
    Friday, March 05, 2010 6:52 AM

All replies

  • Hi Arnel,

    If you want to execute a batch file you can use the InvokeProcess activity to do this. Open the build definition and open the toolbo and drag the InvokeProcess activity to the corresponing place in the build process workflow. For example, you can place it after the "Try Compile, Test and Associate....." activity.
    Here is an example on how to use the InvokeProcess activity:
    https://blogs.blackmarble.co.uk/blogs/rfennell/archive/2010/02/23/logging-results-from-invokeprocess-in-a-vs2010-team-build.aspx

    If all you need is to copy a directory from one place to another, it is easier to use the CopyDirectory activity that is included in the toolbox instead.

    Regards
    /Jakob
    Blog: http://geekswithblogs.net/jakob Twitter: http://twitter.com/osirisjakob
    Thursday, March 04, 2010 1:13 PM
  • Hi jakob,

    I tried your suggestion and put the CopyDirectory activity after "Try Compile, Test and Associate" activity and its perfectly working, btw, can anybody direct me on how to automate publishing/deploying web contents from development to staging(external server) then to production? Does it use CMS/Content Management System? I can automate putting a zip copy of the web contents to staging through FTP, only problem is how can i extract and put it to the website directory. I'm thinking of a Web based File Manager with zip/unzip support but i can't find a .net version.

    Regards
    Arnel Gracela
    • Marked as answer by arnelgracela Wednesday, March 10, 2010 7:55 AM
    Friday, March 05, 2010 6:52 AM
  • Hi

    didn't want to raise a new thread as this one is a perfect description of what i want to do but the solution given is different to the question.

    my problem is this

    i have a build that on completion and succesfully passing tests i want to check in the resultant binaries back to tfs.

    i was doing this as post build task at project level but this would then check in regardless of the tests being run / completing successfully.

    so i looked to drop an InvokeProcess task into the workflow after it has completed.

    My batch file is stored in source control, so is delivered to the build server.

    normally i would pass in $(solutionDir)\xxx.bat as the location but the FileName box won't accept this.

    so how do i call a batch file relative to the solution directory.

    thanks

    Semaj

    Tuesday, June 22, 2010 3:25 PM
  • got it running was down to the scope

    Friday, June 25, 2010 10:11 AM
  • Hello, Jakob?

    I insert the CopyDirectory work flow into my Build Process Template which works good, however, if there is existing files or folder, it gives an error it is not empty.

    But I found a the forum as below from Ewald and looks very impressive to follow up.

    http://www.ewaldhofman.nl/post/2010/04/27/Customize-Team-Build-2010-e28093-Part-3-Use-more-complex-arguments.aspx

    I tired to run xcopy or robocopy but it is not doing anything correctly.

    Is there way to make this working?

    Thanks,

    John.

    Wednesday, July 14, 2010 5:43 PM
  • got it running was down to the scope

    What do you mean "was down to scope?"

    I'm getting a permissions denied error but I referenced it in the local directory: C:\....\bla.bat

    Still trying to work it out


    dan
    Sunday, April 10, 2011 2:39 AM