I have a small internal extension for Visual Studio (VS 2013), and for one function I need to find out if the file on the disk is running the TFS version or not.
(By "running the TFS version" I mean that the specified file is tracked by TFS, so it can be checked, edited, checked, etc.)
The following code is what I have today, and it works fine while you are connected to TFS. It uses an instance of Workspace
// m_workspace is of type Microsoft.TeamFoundation.VersionControl.Client.Workspace var items = m_workspace.GetItems( new[] {new ItemSpec(filename, RecursionType.None)}, DeletedState.Any, ItemType.Any, false, GetItemsOptions.LocalOnly | GetItemsOptions.Unsorted); return items.First().Items.Any();
Now the problem is that when you are not inside the office firewall (or connecting via VPN), the TFS server is unavailable. In fact, the host name will not even be resolved.
So my question is: is there another way to find out if the file is under version control? It's preferable to use an open API, but I'm fine with an ugly hack if that's what it takes ...
source share