How can Remove other work-spaces from Visual studio TFS 2019? - tfs

However VS 2019 is the best IDE, sometimes we want to do somethings and we can not do it. for example, you work on a project and suddenly your PC is crashed and you have some class check out on TFS.
In new PC when you get source you see some sources check out with your user in another pc and you can not check-in or undo them in VS 2019. What can you do?

A tip for solving the problem with another work-space in TFS
Solution
The best way that I find without any writing commands is:
Install VS 2013 and after that get Power Tools for TFS vs 2013
After install power tools, when you get the source with vs 2013 and go to source control explorer, you can right-click on your project and go to find--->findByStatus
and click on find.
you see all files which are checked out by other workspaces and you can undo them
that's easy
Next step. close vs 2013 and open VS 2019 and get your sources and start again write code. (please write clean code :))

You can also use the Attrice TFS Sidekicks available here there are multiple versions for different Visual Studio but they all work against 2019. From the workspace sidekick you can list and remove old workspaces.
Also you can run from the TF.exe command line do remove old workspaces Microsoft doc available here

Related

Visual Studio 2013 Team Explorer is not working

Having installed VS 2013 Premium Update 4 on my VDI going along with Team Explorer for VS 2013 and TFS 2013 Power Tools Update 2 there is a problem with missing Team Explorer extension. While opening VS error occurs as on attached screenshot:
Honestly I have no idea, what causes the problem. I tried to reinstall VS, TFS and several oder hints like clearing Team Explorer cache folder. With no result. And it seems to be VS problem, because from command line I can call TFS and my workspaces are listed properly, so It is installed for sure. As a clue there is kind of error, which occurs while opening solution, and 2 from event viewer:

Visual Studio 2017 and TFS see what files are checked out and to who

In Visual Studio 2015 I could use the TFS Power Tools and then do a "Find by Status" to get a list of all checked out files and who has them checked out.
Does anyone know of a way to do this in Visual Studio 2017? I've read that they do not plan on releasing a TFS Power Tools 2017.
Thank you,
Actually, the "Find by Status" feature only works for Server workspace. If you're using Local workspace, it doesn't show anything.
As a workaround, maybe you could use the tf status command instead, it displays information about pending changes to files and folders.
Or you could use TFS API, here is an example: http://geekswithblogs.net/TarunArora/archive/2011/07/16/tfs-2010-sdk-get-list-of-user-workspaces-and-checked.aspx.

Adding files to Team Foundation Server from web interface

Is it possible to add a new file (or new version of a file) to a TFS project via the web interface without using Visual Studio? There are some code artifacts, such as PS1 scripts, which we may want to keep under source control, but the owners of such files may not have Visual Studio even installed.
No, this functionality is not available in TFS 2013.
This does exist in TFS 2015 (and in Visual Studio Online), but if you are using TFS 2013, you have a few options:
Install the standalone Team Explorer. Despite the name, you do not need to have Visual Studio installed - if you don't, it will install a standalone version that can communicate with a TFS server.
Use the command-line interface. (Also available with the download above.)
Yes it is possible.
In our companies real world example we, have a CI build set up at work that does nothing but code sign powershell files. This was a huge carrot to get the systems engineers to leverage source control. The don't use Visual Studio though. They seem to like using powerGUI which has TFS integration support.
In the TFS 2015 web interface, yes, this is possible.
If you are asking how:
To add a new file, right-click on the folder (in the folder
hierarchy on the left) and there's a menu option to "Add file(s)...".
To edit a file (add a version), open the file contents in the right pane, and
there's an "Edit" button.

How to revert (Roll Back) a checkin in TFS 2010

Can anyone tell me how to revert (roll back) a checkin in TFS 2010?
You have two options for rolling back (reverting) a changeset in Team Foundation Server 2010 Version Control. First option is using the User Interface (if you have the latest version of the TFS 2010 Power Tools installed).
The other option is using the TFS 2010 version control command-line application:
tf.exe rollback
I have information about both approaches on my blog post.
For Team Foundation Server 2012, 2013, or Visual Studio Online, rollback is now built-in directly to Source Control Explorer and when you are opening a changeset's details in the Team Explorer Window. You do not need to install any release of the Power Tools for this functionality when using Visual Studio 2012 or later. There is a great MSDN article discussing details about rolling back a changeset now available here: http://msdn.microsoft.com/en-us/library/ms194956(v=vs.110).aspx
For 2010, use the rollback command from the command line. There is not integrated support in the IDE for this, as of yet.
Rollback command
Basically, the way that it works is that it creates an "anti-delta" to negate the impacted changeset. You can accomplish the same thing manually by doing a Get Specific Version, adding a space to the file so it looks like it changed, and checking it in. I still go the latter route to back out a change if I need to for a single file, as I find it quicker to do.
Without using power tools or command line:
ensure Tools->Options->Source Control->Visual Studio Team Foundation Server UNCHECK Get latest version of item on check out
View the history of project folder in Source Control Explorer and right click on the changeset to roll back to and choose Get This Version
Check out for edit on the project folder in the Source Control Explorer (this should keep your local version you just got from the history)
Check in pending changes on the project folder in the Source Control Explorer
if visual studio asks you to resolve conflicts, choose keep local and attempt check in of pending changes on the project folder in Source Control Explorer again
Rolling back changes for another user
If you are attempting to rollback changes for another user, make sure you get latest on the files you are attempting to rollback; otherwise you will see the error:
"No changes to roll back."
You can rollback a changeset (in TFS2010) through command line doing:
Open CMD or Visual Studio Command Prompt
Change directory to your workspace folder. Example: cd C:\myWorkspace
Run following tf command (where 123 is changeset number)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" rollback /changeset:123 /recursive
Go to Pending Changes window to check files marked with edit,rollback and do a Check In.
Note: you must use tf.exe full path even in Visual Studio Command Prompt to avoid "Unable to determine the workspace" error. More info here
Rollback reference (TFS 2010)
https://msdn.microsoft.com/en-us/library/dd380776(v=vs.100).aspx
right click file in Visual Studio and Source Control/View History
then select last changeset, right click and click Rollback
After rollback done, you should check in again.
There is no undo option in TFS (up untill 2008, I haven't used 2010 yet).
There are some command line power tools you can use to rollback changes that may help:
http://msdn.microsoft.com/en-us/library/ms194956%28VS.80%29.aspx
HTH

How can I easily diff/compare 2 shelvesets in TFS?

Is there a way to compare 2 shelves in TFS without having to resort to unshelving both in separate workspaces and diffing the files?
I was looking for the same i.e. to compare the contents of two shelveets without needing to unshelve one of them. End up writing a Visual Studio extension for the functionality.
The extension is available for Visual studio 2013
http://visualstudiogallery.msdn.microsoft.com/1fa59764-efc6-457a-a5f3-81ca68e280e8
and for Visual studio 2012
http://visualstudiogallery.msdn.microsoft.com/33c521d4-73fc-48be-969d-fa68c511341f
Please feel free to use and give your feedback.
I don't have access to TFS currently, but if the file in the shelveset has a unique idenitifer (like say $/x/y/z/a.b.c;SH='ShelvesetName') you should be able to issue a command line tf dff command to compare each one.
Or
If you unshelve one and then use the command line TFS power tools to compare the other one with the review command
tfpt review /shelveset:shelvesetName;userName
The power tools are version specific and you can download the following versions:
TFS Power Tools 2015
TFS Power Tools 2013
TFS Power Tools 2012
TFS Power Tools 2010
TFS Power Tools 2008
TFS Power Tools 2005
In Visual Studio you can go to Team Explorer, Pending Changes, Actions - Find Shelvesets, then find your Shelveset, right click and View ShelveSet Details, you end up with a list of file, right click the one you're interested in and choose Compare with Workset.

Resources