How to know the TFS repository to which a workspace is bound? - tfs

Is there a way to check to which repository a local is bound to ?

If you know the owner of the workspace or the computer name, you can use the tf /workspaces command to get detailed information about all the workspaces.
http://msdn.microsoft.com/en-us/library/54dkh0y3(VS.80).aspx

Related

Let Jenkins build from multiple TFS repositories

I have a problem with Jenkins building my source code. I'm using a lib repo and a repo for my code. I want Jenkins to build the project if anything in one of the repos changes.
Does anyone has some pointer how to solve this? I managed to get it working in the case that everything is in only one repo, but I want to separate the lib and the project code.
Unfortunately,the TFS pluging for Jenkins currently does not support checking out the sources from multiple locations.
However, as a work around you could use the command line to create any sort of workspace that you like, and even copy a template workspace that you have lying around.
To achieved this use both TF and the powershell Snapin Microsoft.TeamFoundation.PowerShell.
Basically the workflow is as follows :
Get-TFsWorkspace (Powershell : To check for the workspace)
TF Workspace /new (To Create a workspace)
TF Workfold /unmap (use this to remove the default $/ mapping which is
made during workspace creation)
TF Workfold /map (To map specific locations, ie $/Repo/project)
TF Scorch (to remove any artifacts if there are any)
TF Get (To get the code)
More details please refer this answer in a similar question.

What's the big deal about Workspaces in TFS

What's the big deal about Workspaces in TFS.
I just want to monitor some folder for changesets and checkins and copy them to some other tfs folder, and I don't understand why workspaces are so
important. There is not one accepted solution in stackoverflow that
does not mention workspaces. Why do I need workspaces to use tf
commands, such as tf checkin, tf add, etc. It's pretty frustrating..
thanks..
Please understand the workspace first. TFS stores your code, but when you begin to make changes to the code, those changes have to happen on your local machine. The code files need to be checked out from TFS to a local area on your computer. A "workspace" in TFS defines where the code resides locally.
In essence, a workspace is a folder, or multiple folders, mapped to areas in TFS. When code is checked out of TFS, the code is stored locally based off your workspace mappings. When you make changes to your code files, you are making those changes locally, to the files contained in your workspace.
One of the main reasons for workspaces is isolation. It provides a private sandbox where code changes can be made without having to worry if the changes will affect other team members. The changes remain in the local workspace until are checked into TFS.
For tf commands, it's designed based on the workspace for version control, please refer to below articles to understand more about the workspace and tf commands:
An introduction to TFS Workspaces
Workspaces in Team Foundation Server
Using TFS Source Control From Command line tf.exe

Can't run some TFS commands

I am trying to change the owner of a TFS Project Collection with this command:
tf workspaces /collection:http://appdev:8080/tfs/applications applications;OLD.OWNER /newowner:NEW.OWNER
But I am getting this error:
Unrecognized command option 'newowner`
I also tried with workspace instead of workspaces as suggested by Giulio, but with this error:
The workspace applications;OLD.OWNER does not exist. Please specify an existing workspace or /new to create one.
Also tried adding a /computer:COMPUTERNAME switch, but this gives the same error as the previous attempt.
Interestingly, when I try querying all workspaces with
tf workspaces /collection:http://appdev:8080/tfs
I get:
Unable to retrieve the registration information for 'ISCCProvider'
And the same error is produced if I specify the computer
I am running this command from the Developer Command Prompt for VS2015, but not on the TFS server itself (I am running it from my machine).
I am the owner of all project collections.
I am able to call tf workspaces without any issue, and I can also call tf workspaces /collection:http://appdev:8080/tfs/applications with the expected results.
What could possibly be going wrong here?
When you typing
tf workspaces /collection:http://appdev:8080/tfs
You will definitely get this error
Unable to retrieve the registration information for 'ISCCProvider'
Since this command tf workspaces it's collection level not server level, your address (http://appdev:8080/tfs) is server url, you just need to add your collection info of the url such as http://appdev:8080/tfs/applications The error will disappear.
In your case :
First typing
tf workspaces /collection:http://appdev:8080/tfs/applications
This will list all workspaces belongs to you on your computer.
Then typing
tf workspace/collection:http://appdev:8080/tfs/applications workspacename/newowner:xxx
The workspace name is the one which you want to change the owner.
You can get the info from the first command. You don't have to add
the older owner name and option, just need to add new owner
name.
Finally you cloud also typing
tf workspaces /collection:http://appdev:8080/tfs/applications
again, you will see
the changed workspace will not list any more. This is make
sense, since the owner is changed and the workspace not longer
belongs to you.
Mind the spelling: you want tf workspace but you typed tf workspaces which is a different command.
tf workspace and tf workspaces command is used to set/configure the workspaces, and the command used to change the owner of the workspace is:
tf workspace /collection:http://appdev:8080/tfs/collectionname workspacename;oldowner /newowner:newowner
You cannot use this command to change the settings for project collection.

How to delete all the worskpace that are mapped to a physical folder in TFS?

I am using TFS 2013.
What would a command to Delete All the WorkSpace belonging to any Agent that is mapped to a specific folder look like?
For Example all the Workspace that are mapped to "C:\ABC\Common" should be deleted.
Want to add script as pre build Task
I would use the (free) tool TFS Sidekicks to do this. You can easily view all the workspaces for that computer/agent, and see the mappings for each one. Also you can easily delete all the relevant workspaces from the tool in a nice GUI.
http://www.attrice.info/cm/tfs/

Phantom TFS workspace will not let me map to another workspace?

I type this command: tf workspaces into a command line and it tells me there are no workspaces on the machine. I then try the same command on the server, nothing. So I go into Visual Studio 2010 and create a new workspace and try to map the TFS path to my local path. I then get an error that the mapping already exists in another workspace. But I cannot find that workspace on my local or on the tfs server. Any ideas?
You can run tf workspaces /remove:* to clear out your local cache of workspaces. See this link for more details.
I know this is an old question, but I just came across this issue on a Linux machine running TEE (Team Explorer Everywhere). Running "tf workspaces -remove:*" didn't work, because it said there were no workspaces in the cache.
The user was trying to create a new workspace, which worked, but when he tried to map folders, it told him it didn't exist.
When he ran "tf workspaces" on the machine and when I looked in TFS Sidekicks on the server itself, it didn't show any workspaces for him on the Linux box.
If he tried to create the workspace again, it told him that it already existed, but every time he tried to map, he was told it didn't.
We could see the workspace from the tf command line if I did "tf workspaces /owner:", and it required me to run "tf workspace /delete ;" from the command line to get rid of it.
Once we did that, he was able to create it again and everything worked properly.
No idea why that happened, but figured I'd post my answer here just in case someone else comes across a similar issue in the future.

Resources