Проверьте { 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);
Это было именно его , Я не указывал на допустимый путь к файлу. Мне также пришлось установить recursionType.None, а также – zachary