Answered tf get latest to a specific location

  • Monday, May 22, 2006 11:47 AM
     
     

    is it possible to get latest version of file to any location I want with tf?

    Not just to the workspace 

     

    Thanks

    Avi

All Replies

  • Monday, May 22, 2006 12:35 PM
     
     Answered

    Hello,

    unfortunatelly no - get is always performed to the mapped location. You can look at tf view command, it let you download copy of the file to the temporar location.

  • Monday, May 22, 2006 12:46 PM
     
     

    Thanks

    Is there a way to prevent the file from being viewed ?

    Avi

  • Monday, May 22, 2006 1:19 PM
     
     

    Use /console switch and redirect output to the file:

    tf view /console foo.txt > c:\foo.txt

  • Monday, May 22, 2006 2:09 PM
     
     

     

    The command I try is

    view /s:server-cm $/prod/Development/Projects/Common/Utils/MMC.exe > c:\\MMC.exe"

    When I run the command from the command line it works fine.

    When I run it from cod I get "illegal characters in path"

    my code is

    System.Diagnostics.ProcessStartInfo psi =

    new System.Diagnostics.ProcessStartInfo("tf.exe",args);

    psi.UseShellExecute = false ;

    System.Diagnostics.Process p =

    System.Diagnostics.Process.Start(psi);

     

    Where args is view /s:server-cm $/prod/Development/Projects/Common/Utils/MMC.exe > c:\\MMC.exe"

    Thanks

    Avi

  • Monday, May 22, 2006 4:57 PM
    Moderator
     
     Answered
    I don't think you can use '>' that way with Process.Start. Maybe if you set UseShellExecute to true.

    Instead of doing it that way, capture the stdout into a stream and write it to disk using System.IO.FileStream.

    Even better: use the TFS object model: VersionControlServer.DownloadFile()
  • Monday, May 22, 2006 8:48 PM
     
     

    Thanks Richard

    But Downloadfile() would work from 2005 only ? The reason I use tf.exe is because I need it to run in 1.1 framework

     

    Avi

     

  • Monday, May 22, 2006 10:17 PM
    Moderator
     
     
    You're right.  I don't think you can reference our product DLLs from 1.1 code.
  • Tuesday, May 23, 2006 7:39 AM
     
     

    this is what I've tried

    string args ="view /s:server-cm $/prod/Development/Projects/Processes/AssemblyInfo.cs /console";

    System.Diagnostics.Process p = new System.Diagnostics.Process();

    p.StartInfo.UseShellExecute = false;

    p.StartInfo.RedirectStandardOutput = true;

    p.StartInfo.FileName = "tf.exe";

    p.StartInfo.Arguments = args ;

    p.Start();

    string output = p.StandardOutput.ReadToEnd();

    But the output param is empty.

    Avi

  • Tuesday, May 23, 2006 1:07 PM
     
     

    Could you add to your code

    p.StartInfo.RedirectStandardError = true;

    and check if

    p.StandardError.ReadToEnd()

    contains any errors?