How to check when TFS Workspace.Get method is complete?
I am us开发者_如何学Cing the Workspace
class from the Microsoft.TeamFoundation.Client
namespace to get the latest code for a particular branch from a Team Foundation Server.
workspace.Get(new string[] { SelectedRelease.ServerPath }, VersionSpec.Latest,
RecursionType.Full, GetOptions.GetAll);
After I get the latest code, I build the relevant solution programmatically. The code can be found in the post here.
My question is 'how can I find out when the Workspace.Get method is complete? I can't build it until it has finished downloading. I thought about monitoring the solution folder, but I don't know which order the files are built in.
It's not asynchronous. As soon as it returns, your get has finished.
If you want to listen for completion in another thread (and use TFS's event system to do so instead of rolling your own), you can hook up a GettingEventHandler to your VersionControlClient.
This question may be of use to you:
Using the TFS 2010 API to subscribe to Workspace Events
精彩评论