florianbaer
florianbaer

Reputation: 170

After move TFS, Workstation.Current.GetLocalWorkspaceInfo returns old host name

We recently moved our TFS-Instance to another server. I've changed the TFS mapping in the Visual Studio Settings for 'Manage connections' - Get latest version and all TFS features work as expected.

Problem: We have a tool, which allows us to move files to a dedicated directory in TFS by it's filename. To determine the TFS uri, this tool uses the following code:

WorkspaceInfo workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(sourceDirectory);

and this method returns the old TFS uri instead of the new one, even though the workspace information mapping points to our new server...?

Workspace information is correct And debug output returns still old host path

Upvotes: 1

Views: 318

Answers (1)

PhilippD
PhilippD

Reputation: 111

Open a command prompt as administrator and change the directory to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE or the corresponding directory depending on your Visual Studio version.

cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE

Then run the following command:

tf workspaces /collection:http://ServerName:Port/VirtualDirectoryName/CollectionName

in my case this was:

tf workspaces /collection:http://tfs.domain.com/DefaultCollection

This will refresh the version control cache and

Workstation.Current.GetLocalWorkspaceInfo(sourceDirectory); 

should return your new TFS URI.

Upvotes: 2

Related Questions