So after the TFS upgrade from 2010 to TFS 2013, my web application which used the Extension libraries inVisual Studio 2013:
![libraries]()
![]()
The application was using the Version 11 libraries before (when it did work with TFS 2010), then we did the upgrade to TFS 2013, and the web app was still using the Version 11 libraries, but it did not work, so I changed thelibraries to Version 12 thinking that was the issue, but it still does not work.
The issue comes down to the Workspace and possibly the checking out of the files, but is more related to the Workspace I think.
Here is the summary of the code I am using:
Client Application
TFS.WorkspaceDirectory = "c:\temp\MirthBackupWorkspace\Shared";
TFS.WorkspaceName = "MirthBackupWorkspace_Shared";
//instantiate a new TFS Project Collection object
TFS.MirthTeamProjectCollection = new TfsTeamProjectCollection(new Uri("http://TFSSERVER:8080/tfs/integration"));
// Get a reference to Version Control. (this will vary for your specific project)
TFS.VersionControlServer = MirthTeamProjectCollection.GetService<VersionControlServer>();
//creates a new TFS workspace.
workSpace = CreateWorkspace(TFS.WorkspaceName, TFS.WorkspaceDirectory);
string workspaceDir = TFS.WorkspaceDirectory;
string tfsWorkspaceFolderDir = workspaceDir + "\\TestDirectory";
//CHECKOUT existing TFS files
//verify if we have the latest and get the latest version before checking out
count = workSpace.PendEdit(new string[] { tfsWorkspaceFolderDir }, RecursionType.Full, null, LockLevel.CheckOut, false, Microsoft.TeamFoundation.VersionControl.Common.PendChangesOptions.GetLatestOnCheckout, null);
if (count == 0)
{
TFS.Status = eStatus.Error.ToString();
}
else
{
TFS.Status = eStatus.Success.ToString();
}
public static Workspace CreateWorkspace(string workspaceName, string workspaceDir)
{
Workspace workspace = null;
try
{
//this will fail if there is already a workspace that exists with that name
workspace = TFS.VersionControlServer.CreateWorkspace(workspaceName, TFS.VersionControlServer.AuthorizedUser);
//map the workspace to a local directory
workspace.Map(State.ConfigurationState.TFS.Project, workspaceDir);
}
catch (Exception e)
{
//on fail, get the current workspace
workspace = TFS.VersionControlServer.GetWorkspace(workspaceName, TFS.VersionControlServer.AuthorizedUser);
}
finally
{
//get the lastest files from TFS
workspace.Get();
}
return workspace;
}
So the issue I am having, is that workSpace.PendEdit(....) is returning a zero (0) count, when there clearly are items in that workspace that can be checked out.
Does anyone have any idea why this may be occurring?
Any suggestions would be helpful?
Thanks in advance.
Thanks. sc