4

I'm developing code on my machine using one local workspace to get and check in code from TFS. I'm also building an automated CI app which uses my machine and needs to get the latest code. I use the following to get latest for the CI app:

tf get $/abc/abc /recursive /all

I want to use a different local workspace, a CI workspace, to get latest to avoid conflict with dev code. BUT using tf, I'm not able to specify a workspace when using the get command and the MSDN doc doesn't show anyway to do this. How can I use "tf get" to specify the workspace I want to use?

Stagg
  • 2,660
  • 5
  • 34
  • 32

2 Answers2

8

Prior to the tf get, change directory to one of the directories mapped in the CI workspace. tf get will base the server and workspace off of the details for the mapped drive.

Robaticus
  • 22,857
  • 5
  • 54
  • 63
0

I am also creating an automated build process and as part of this performing a 'clean' get i.e. renaming the current local workfolder and then re-getting the files from tfs to a clean copy of the work folder prior to performing full build and unit testing. I am using a Nant script in a separate folder and so couldn't just change directory (changing the current directory within Nant doesn't work for this problem). My solution was to create and run a batch file. Sample Nant script below:

<!--do a clean get to the solution folder-->
    <target name="clean_get">

    <!--Create the batch file-->
    <property name ="batch.file" value="clean_get.bat" />
    <echo file="${batch.file}" append="True">md ${workfolder.path}</echo>
    <echo file="${batch.file}" append="True">${environment::newline()}cd ${workfolder.path}</echo>
    <echo file="${batch.file}" append="True">${environment::newline()}tf get $/${project.name}  /recursive</echo>


    <!--Run the batch file-->
    <exec program="clean_get.bat" >
    </exec>

<!--Delete the batch file - we're done with it-->
<delete file="${batch.file}" failonerror="false" />

Jude Wood
  • 76
  • 6