0
votes

I wrote an Visual Studio Extension for our Company, which gets the Specific Version of Files in a Solution based on Microsoft TFS. We use Visual Studio 2015 / 2019.

My question is, is there some way to set the "Latest" Information of an File which gets displayed in the Source Control Explorer programmatically?

Like this: Latest Information Visual Studio

So i have a list with all files which i want to get. Before i used this method to get for every file:

WorkspaceInfo workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(filePath);
Workspace ws = workspaceInfo.GetWorkspace(new TfsTeamProjectCollection(workspaceInfo.ServerUri));

status = ws.Get(new GetRequest(new ItemSpec(filePath, RecursionType.Full), VersionSpec.Latest), GetOptions.GetAll);

This worked fine and refreshed the latest information. Sadly this method is to slow compared to the "real" Get Specific Version from Visual Studio.

Now I tried this method, which is much faster, but doesn´t change the latest information of the file:

item.DownloadFile(filePath);

Even if I downloaded the file (I checked the differences between changesets) and got the latest version of it, the information in Source Control Explorer keeps saying "No".

Does someone know a solution for this, or even a better solution?

1
Could you specify why do you want to set the "Latest" information? This information indicates whether the file is the latest version in local workspace. Would this API help you: markheath.net/post/how-to-use-tfs-api-to-retrieve?Cece Dong - MSFT
Why you dont use the VersionControlServer.DownloadFile instead the item.downloadfile? linkLeo BL

1 Answers

0
votes

Why you don't use the VersionControlServer.DownloadFile instead the item.downloadfile? https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/bb138622(v%3Dvs.110)