locked
MSBuild RRS feed

  • Question

  •  

    Hi,
         Can you tell me there is a way to create a work space mapping and check out/in files via MSBuild task(s)? Any help is apperciated.

    Thanks,
    B

    Tuesday, November 18, 2008 5:57 PM

Answers

  • Hi,

    Yes you can use the TF.EXE commandline tool to perform these operations. To execute command line tools from within MSbuild, you use the EXEC task.

    First, for ease of use, you can map the tf.exe including path into an MSBuild property:

    <PropertyGroup>
    <
    TF>&quot;$(TeamBuildRefPath)\..\tf.exe&quot;</TF>
    </
    PropertyGroup>

    Then, you can use $(TF) as exec command:

    <Exec Command="$(TF) get *.*" WorkingDirectory="$(SolutionRoot)\Deploy\" />
    <
    Exec Command="$(TF) checkout *.*" WorkingDirectory="$(SolutionRoot)\Deploy\" />
    <Exec Command="$(tf) checkin /noprompt /override:BuildServer /comment:&quot;Checking in new version of xxxx ***NO_CI***&quot; &quot;$(SolutionRoot)\Deploy\*&quot;"/>

    Here is the full reference for the TF.EXE command line interface: TF.EXE

    To add/remove workspace mappings you can use the workspace command line options:

    <
    Exec Command="$(tf) workspace /delete /noprompt &quot;$(TempWorkspace)&quot;" WorkingDirectory="SomePath" >
    <
    Exec Command="$(tf) workspace /new /noprompt &quot;$(TempWorkspace)&quot;" WorkingDirectory="SomePath">

    Hope that helps
    Regards
    /Jakob

    • Proposed as answer by Bill.Wang Thursday, November 20, 2008 4:02 AM
    • Marked as answer by Hua Chen Thursday, November 20, 2008 10:54 AM
    Tuesday, November 18, 2008 10:26 PM