Saturday 15 September 2012

c# - How do you get the latest version of source code using the Team Foundation Server SDK? -


I am trying to drag the latest version of source code outside the TFS program using SDK, and I Does not work in any way:

  string workspacename = "myvarspace"; String projectpath = "/ testpe"; String Workers = "C: Projects \ Test \ TestApp"; VersionControlServer Source Control; // Actually before this method, immediately ... Work [Work] = sourceControl.QueryWorkspaces (WorkspaceName, sourceControl.AuthenticatedUser, Workstation.Current.Name); If (workspace.line and gt; 0) {sourceControl.DeleteWorkspace (workspacename, source control .auticic user); } Workspace workspace = sourceControl.CreateWorkspace (WorkspaceName, Source Control, Etiquetic User, "Temporary Workspace"); Try {Workspace.Map (projectPath, Work Directory); GetRequest Request = New GetRequest (New ItemSpec (projectPath, RecursionType.Full), VersionSpec.Latest); GetStatus Status = Workspace. Go (Request, GetOptions.GetAll | GetOptions.Overwrite); // This line does nothing - no failure or errors} Finally {if (Vertical! = Zero) {Vertical. Remove (); }}  

The approach is basically creating a temporary workspace, by using the go method to capture all the items for this project, and Then removing the workstation is the right way to do this? Any example would be useful.

I am using a different approach that starts working, is taking advantage of the main method Of:

  version control source source control; // Actually instantiated ... ItemsSet items = sourceControl.GetItems (sourcePath, VersionSpec.Latest, RecursionType.Full); Foreign objects (Items in items item items) {// build relative path string relativePath = BuildRelativePath (sourcePath, item.ServerItem); Switch (Item Indem Type) {Case Item Type: Any: Delete New ArgumentOfferance Exception ("Item Type was returned Any, Expected File or Folder."); Case item type. File: Items. Download file (path. Cobain (target path, relative path)); break; Case ItemType.Folder: Directory.CreateDirectory (Path.Combine (targetPath, relativePath)); break; }}  

No comments:

Post a Comment