How to delete all workspaces in TFS 2010 - visual-studio-2010

How do I delete all workspaces on the automated build server? We had an issue where we had to keep changing the credentials on the build agent for TFS 2010, and then if we tried to deploy the build next time for all our build definitions it gave the error that the workspace already existed under a different user.
I know we can do this:
tf workspace /delete /server:http://localhost:8080/tfs/DefaultCollection 26_1_internalserver123;MYOFFICE\brian.colley
But we have to manually do that for every build definition, and we don't really know the workspace number until we try and run the build and it gives the error.
In MSDN it says you can do a /remove:, but /delete: doesn't work (or isn't even in the msdn command options which is weird). I didn't know if remove is doing something that I don't want, versus delete.
Should I do this, or will it mess up all the users in TFS on their local boxes?
c:\projects>tf workspaces /remove:* /collection:http://myserver:8080/tfs/DefaultCollection
Thanks!

Install TFS Sidekicks, you can clean them up with a nice pretty GUI.
you can filter by the build account and a machine and then delete only the specific workspaces you are interested in

Related

Visual Studio TFS Workspace Mapping Question

We use Azure DevOps for TFS here. This developer is receiving an upgraded workstation and is trying to setup her workspaces in visual studio. When she attempts to create a workspace on her new workstation she receives the error "The workspace XYZ already exists on computer OLD-PC".
I know I can do some hacky visual studio command prompt stuff to delete the old workspace mappings on the TFS server, but I was hoping to understand the error a bit better. Is she receiving this error because TFS workspaces mapped to a project must be unique in name? I was a bit confused why it would be giving an error for a workspace already existing on a different PC, I thought it would identify by the new PC name and workspace name and not cause an issue.
Any insight or general guidance on workspace mapping conflicts would be appreciated. I need to learn a bit more about how this works.
Thanks in advance!!!
Customer will encounter this error ‘workspace xyz already exists on computer abc’ when trying to create a new local workspace while the old workspace persists.
And testing in my side and found that TFS workspaces mapped to a project must be unique in name.
To resolve this issue, you could rename your new workspace or use the tf workspace command to delete other's old workspace. Make sure you have own manage other users workspace permission. Otherwise, you need to get your TFS administrator to delete the workspace if you have no access to the account. Just using below command.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
See: Visual studio alerts workspace already exists for more details.

TFS build runs with old code after checking in changes

Recently, I have been facing this issue where my TFS(2015 update 3) msbuild runs with old code even after checking in changes and saving changes locally in visual studio 2015 enterprise edition. I use build to run Automated UI test by running my machine as test agent.
I can see an agent workspace other than my workspace(don't know if anything to do with it).
Can anyone guide me to correct this issue, or anyway to move forward without facing this issue again?
Please try below items to narrow down the issue:
Check the source code via web portal, verify that the new changes are
really checked in.
Check the definition setting, try to set "Clean" to "True" in
Repository tab.
Also enable the "Clean" option in MSBuild step.
Try to create a new definition with the same settings, then try it
again.
Clean the caches for your TFS Application Tier and agent machine,
then try it again.
Reboot the TFS and agent machine
UPDATE:
Below screenshot for your reference, also make sure you mapped the source correctly. You can also try to delete workspace and entire source folder directly from your agent machine, eg C:\Agent\_work\2\s (You can get the info from build log)

Visual studio alerts workspace already exists

I am having an issue with one of the users of a TFS server I manage. We recently went through a user ID change and as such this messed up some of our workspaces. I am trying to get a new local workspace made on her machine and it keeps saying that the locally mapped folder is already used for her old workspace.
We have deleted all of the TFS and VS cache folders, did userdatareset, and using the tf.exe workspaces command it does not list this offending workspace that I am trying to get rid of. Is there other approaches I can use to get rid of this workspace.
If you want to use the tf workspace command to delete other's old workspace. Make sure you have own manage other users workspace permission. Otherwise, you need to get your TFS administrator to delete the workspace if you have no access to the account. Just using below command.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
You could also use Team Foundation Sidekicks, for TFS2015, it's version 6.0
How to use the tool:
After download and install it, you need to connect to TFS
server with your current authentication.
Open tools- select workspace sidekick
In the filters, select the owner name, computer name,
access date
Finally, you should be able to delete the abandoned workspace.
Note: TF Sidekicks uses the same commands so would require the same permission. It is a TFS admin productivity tool.
More details please refer the similar question: Delete Old Workspaces on TFS VS2013
You can use Team Foundation Sidekicks to view all workspaces for that particular machine and delete the ones you no longer need.
I use it to clean up workspaces for people that left the company and workspaces that people forgot they had on their old machines. In theory, you should be able to do everything with tf.exe, but using Team Foundation Sidekicks, just makes it a lot easier.

Automatically place drop in source control folder - VSO Build

I am building my solution in Visual Studio Online Build, the default 'steps' are build/test/index+publish/publish build artifacts. I want the build to be placed in a folder in my source control (rootfolder/builds). However, I don't see an option to enter an output-path anywhere.
EDIT: I see that next to 'timeline' on the build screen there is the option to view the 'Artifacts', but, I want to see/copy the drop to my TFS online project folder like '$myproject/mybranch/builds/'
The option to store the build drop on the TFS server is no longer supported. It was introduced as a temporary measure in 2012 and replaced with server drops in 2013.
Server drops are stored in an unversioned store in TFS/VSO and does not incur the overhead of versioning.
In TFS 2015 this transitioned to the new Artifacts repository. All build output is stored on the server and is accessible in the web, and through an API.
The way things stand right now, this is not possible. You have two options to drop your build outputs
Team Foundation Server
UNC file share if you use a on-prem agent.
See the Artifact Type argument on Publish build artifacts.
I it is possible with a custom powershell task. I have recently created a powershell build task that could "check-in" your drop artifacts into a folder like $myproject/mybranch/builds.
Have a look : https://github.com/skuvnar/visual-studio-team-services-scripts.
Although its possible, I would suggest against it - could lead to all sorts of trouble with the builds.

Cannot edit source files locally without checking out file on TFS

Me and 2 colleagues are using TFS and VS 2013 on a shared project. Me and my Colleague "Bill" are able to edit files and check them in whenever we like. But colleague "Bob" cannot do this. They appear as "locked" in his solution unless he goes into TFS and specifically checks out the file. Me and Bill dont need to do this, we can simply edit the files and if we both try and check in the same file it notifies us of merges. Bob has the same TFS permissions as us, and as far as I can see the same visual studio settings.
Any ideas on what might be causing this?
This sounds like a workspace issue.
Bob needs to change his workspace from a server workspace to a local workspace. If he's using VS2010 or earlier, he will not have that option -- local workspaces are only supported in VS2012 or later.
Here's an MSDN link on how to configure local workspaces:
http://blogs.msdn.com/b/visualstudioalm/archive/2012/10/05/set-local-workspaces-as-default-when-upgrading-to-tfs-2012.aspx

Resources