2016-06-30 1 views
0

Я пытаюсь сделать workspace.get в одном файле. Однако, когда я вызываю этот метод, я получаю весь каталог и подкаталоги. Каков правильный синтаксис для получения только файла.TFS Workspace.Get метод

Workspace ws = _server.GetWorkspace(GetLocalPath(serverPath)); 
      ws.Get(new string[] { serverPath }, changesetSpec, RecursionType.Full, GetOptions.GetAll | GetOptions.Overwrite); 

ответ

1

Проверьте { serverPath } в коде ниже точки до конкретного файла:

ws.Get(new string[] { serverPath }, changesetSpec, RecursionType.Full, GetOptions.GetAll | GetOptions.Overwrite); 

Другой способ получить конкретный файл, вы можете обратиться к this article:

string teamProjectCollectionUrl = "https://YourTfsUrl.com/tfs/YourTfsProjectCollection"; 

TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(teamProjectCollectionUrl)); 
VersionControlServer versionControlServer = teamProjectCollection.GetService<VersionControlServer>(); 

// Get the latest Item for local path "C:\projects\myfiles.cs" 
Item item1 = versionControlServer.GetItem("C:\projects\myfiles.cs"); 

// Get ItemId = 12345 for changesetId = 54321 
Item item2 = versionControlServer.GetItem(12345,54321); 

// Get the latest Item for server path "$/ProjectName/myfile.cs" 
Item item1 = versionControlServer.GetItem("$/ProjectName/myfile.cs", VersionSpec.Latest); 
+0

Это было именно его , Я не указывал на допустимый путь к файлу. Мне также пришлось установить recursionType.None, а также – zachary

Смежные вопросы