Get or download Shelf Code in Team Foundation Server (TFS) - tfs

I am fairly new to TFS, like Mel from this post:
https://softwareengineering.stackexchange.com/q/142977/27650
I had a project on another PC, but I have been issued another PC.
Yes, I could go to management, and bug them with all of the various steps involved with finding and then getting my shelf project that I was working on last week, but I would rather find the information on my own.
I found MSDN's article on Shelve and Unshelve Pending Changes, but it did not cover how to get my shelf item. Perhaps there is a special term that I am unfamiliar with.
Likewise, I read over the article What's New in Visual Studio TFS 2012, since we are using VS2012. It appears to go over the changes that have occurred since the newest release.
How do I find my shelf items, so that I can continue working on them?

your question is answered under "Unshelving" on the page you referred to (Shelve and Unshelve Pending Changes). You click on unshelve and first step you do is finding your sehlveset. However please remember it works only if you shelved your changes before you lost your PC.

I got this resolved, but I did not like the way I found to do it.
In Team Explorer, I opened my last successful shelf item, did a Right-Click and selected View Shelfset Details:
From there, I went to each file listed in the Changes to Unshelf list.
I selected Open for that file, and then physically copied the text from that file to the corresponding file on my PC.
Again, I did this for each file that had changed in my Shelfset Details.
For whatever reason, Team Foundation Server does not pull that data back into my project whenever I select the "Unshelve Changes" option.

Related

Remove project from TFS Source Control when Collection/Team Project don't exist

I have a Visual Studio Solution (2010) containing code projects that were under source control in Team Foundation Server 2010. That collection/project no longer exists, but the code was not removed from the collection. The collection and project have been created over again exactly as it was the first time. When I open the solution in VS, it tells me that it can find my project, it is offline, and asks if I would like to go online. I click yes, but then it errors and says it can not find the workspace. All my files are read only. I assume this is because of the source control and, since it's not hooked up, I can't check them out (remove the read only).
How do I purge the solution of the old and hook everything back up again, short of recreating all the code solutions over again?
EDIT
To clarify:
Collection refers to TFS Collection
Project refers to TFS Team Project
Solution refers to VS Code Solution
The problem is the code solutions are still associated with the team project, which doesn't exist. When I open it, I get the message "This solution is offline, but its associated TFS server is available. Would you like to go online with this solution after it has loaded?" Yes "Unable to determine the workspace for this solution"
When you have loaded the projects, enable the Source Control - Team Foundation Server tool bar, click the "Change Source Control" button (only one enabled) and it asks you if you wish to permanently remove the association with source control.

Deleted a file out side Visual Studio, TFS doesn't recognize it

I am new to TFS. I checked out a folder from TFS using Visual Studio and then deleted bunch of files/added couple of files within that folder using windows explorer (actually I didn't do it, but that folder has third party libraries and I used an installer which made all these changes).
Now if I go to Visual Studio and try to check in that folder, I am getting this error:
Check in: Operation not performed
Could not find file : /ThirdPartyFolder/aDeletedFile.aspx
I tried to follow the solution proposed in this post, but that didn't work out:
http://www.woodwardweb.com/tfs_top_tip/tfs_top_tip_11.html
When I do 'Get Specific Version' and specified 'change set 1', it doesn't show the deleted files in red as it does in the screenshot of that blog post. Also, when I click OK, it shows the Pending Changes-Conflicts window with all the files that got deleted. Even though I selected "Keep Local Version", when I try to check in, I am getting the same error again.
Is there a way in TFS to take what is in my local version and over write what is in the server with my local version files?
I have done similar operations using Subversion, and this has never been a problem. Hopefully someone will let me know how to achieve this in TFS.
Team Foundation Server requires that you explicitly pend changes for these files - if you delete a file locally, this does not explicitly pend a delete against Team Foundation Server. This is actually a useful feature - the server optimizes the data it sends you based on its knowledge of your local filesystem. That is to say, if you say "get latest", it knows your current versions and will only deliver the changes. If you're working with very large projects, this can be very efficient.
However, when other programs decide to make changes without pending the changes to the server, things can get a bit confused. Fortunately, TFS has the ability to detect changes that were made outside without explicitly pending those changes. You can use the "return online" capabilities of your TFS client.
You'll need the Team Foundation Server Power Tools installed, then you can simply run: tfpt online to detect those changes and select which ones to pend to the server.
(VS2012) Select the missing files from TFS "Check In" list and then right click on them and click on "Undo Changes" to exclude them from the list of "Check In"s forever.
This is one of the major differences between svn and tfs. Svn is somehow more integrated with windows shell and every change in your working folder will affect the server on commit. I propose you to perform any move, delete and rename actions within tfs UI, not from shell.

How to undo pending changes in TFS of users that no longer exist

We have a few developers who don't work here anymore, but didn't check all theirs changes into Team Server before they left.
Now their usernames don't exists anymore, and I can't access their pending changes to undo them....
I found a way, not needing command line.
With Power Tools installed (both in 2008 and in 2010 version), Visual Studio shows a node for Team Members in each project. If you right-click on one of the members, you can choose to view all their pending changes. Till now nothing new. BUT, I suddenly saw, in the right hand upper corner of the pending change list, a link that says "Modify Query".
I opened the window, and in it was an input field that let me change the username. I changed it to the username I wanted, and I got his list of pending changes!
Here's a link to the TFS 2008 Power Tools:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=FBD14EEA-781F-45A1-8C46-9F6BA2F68BF0
and the TFS 2010 Power Tools:
http://visualstudiogallery.msdn.microsoft.com/en-us/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Edit by woppers:
I don't have enough Rep to comment so I have to make an edit. I had the same issue as the OP but I am working in TFS 2013 so the procedure is slightly different. Here's what I did.
Go to:
Source Control Explorer
right click on the collection you are working in
Find
Find Changesets...
Enter your LanID in the “By user:” field
Click search
Click find
That will show you all of your pending changes.
Highlight one of them and click “Details...” to view the info in them.
As an administrator of TFS you should have some option of global check in.
something like that in the command line: tf lock /lock:none /workspace:workspace;username $/code/foo.cs /s:http://server:8080
or better yet:
tf undo /workspace:workspace;username $/code/foo.cs /s:http://server:8080
To expand a bit on the awesome answer provided by xr280xr... I needed to undo pending changes of a former employee, and this worked for me on a TFS 2013 server, using VS2015 on my own desktop:
Right click the folder in Source Control Explorer > Find > Find
by Status and enter * as a wild card. You can reduce the results to
a specific user if you know the user name.
When the results appear, you can right-click and select Undo. The
Output window should confirm success.
Note that if the former employees' workspace is on another PC, you'll continue to see the pending changes they have, but they will no longer prevent checkout, build, etc.
I'm guessing that deleting the former employees workspace will get rid of the pending (now-undone) changes, but I haven't tried it yet.

Can TFS Pending Changes show files that are truly changed like SourceGear Vault?

I have been using SourceGear vault for some personal projects and Team Foundation Server for work projects. One thing TFS is missing is a simple feature that Vault has on its check in dialog window.
In the Vault client, you can see if the checked out file changed from the previous version checked in. Here is a screen shot. Notice the column "Details"? That tells you there is a difference. The way this is super helpful is if you have to check out a entire project because you are going to do code re-generation. I'll check out my class library project and then regenerate my CodeSmith templates. Doing this may result in just a few specific files from changing. When I view the pending check-in screen, I see the files that really changed and I can compare to see the impact.
SO... can TFS do this? Maybe there is a 3rd-party tool that will do it for me? Is there a TFS SDK or PowerTool that I have to get. Anyone want to build it?
Select all the files in "Pending changes" window and activate the context menu. Then click "Undo..." > "Undo Changes" > "No to All".
The files without changes will be rolled back.
Per this page, you can run this command from the Visual Studio Command Prompt.
tfpt uu /noget /r *
You'll need to have TFS Power Tools installed for this to work. Also, make sure you browse to the root of your mapped folder within the command prompt (ie - C:\TFS for example).
TFS Power Tools links (if you don't already have it)
TFS Power Tools for 2010
TFS Power Tools for 2012
There is no need to undo the unchanged files, as TFS will notice they're unchanged upon checkin and will only associate the truly changed files. Any files checked out but unchanged are reverted to their last known checked in version and will not be associated with your checkin. It is impossible in TFS (though not very clearly documented) to check in an unchanged file. It will always revert to the previous version if there are no changes.
You can quickly undo your unchanged files by calling 'tfpt.exe uu /r' from the command line (you need to have the Team Foundation Power tools for this) or by using the "Undo unchanged" button in the Pending changes window. This removed any items from the list that are unchanged immediately. So that you can see exactly what you're checking in.
Though it might be that this option is added by the Team Foundation Power Tools or the TFS Source Control Explorer Extensions (which are a must have for every TFS user anyways).
See also:
https://stackoverflow.com/a/2100981/736079
https://stackoverflow.com/a/6387656/736079
https://jessehouwing.net/vsts-tfs-why-i-like-them/
I don't like answering my own questions, but it looks like there might not be a real Microsoft solution out there. For me, this is how I handle the problem at the office using Visual Studio.
Before I re-generate the business objects, I make a copy of the entire folder structure
I check out the entire project or the root generated folder
I start the code generator. Sometimes, I know exactly what is changing, but other times, I might make a lot of changes and I don't want to miss anything. My code generator at work also generates all the SQL files needed to DROP / CREATE stored procedures.
Using SourceGear DiffMerge, I compare the folders of the just generated and the previously backed up folder.
This is pretty time consuming. I never thought of it as a problem until I saw Vault identifying that a file was different on disk from the repository.
Maybe you all can say how you do code generation / regeneration when working with a source control repository.
I work in a corporate development environment where many developers may be working on the same file, and we have TFS as our source control as well. In our document of Best Practices for TFS, we really discourage checking out files that the developers don't intend on changing, that way we naturally exclude files without differences when submitting a changeset.
To answer your question, I normally just look at the "Pending Changes" window and run a Compare on the "changed" files that I'm unsure of--the Compare tool should immediately tell you if your local copy is the same as the server copy. Unfortunately, there's no real workaround other than what I suggested, but I don't see the scenario where I absolutely must check out an entire project branch for editing.

Source Control Explorer Shows Pending Changes, But In Pending Changes Window does not show

In TFS Source Control Explorer it shows pending changes (edit,[more]) with my name, but the Pending Changes window does not show any pending changes.
What I thought is, months ago my Visual Studio crashed, and at that time some files were checked out (which I was not aware of, due to the automatic checkout nature of TFS). Due to that, I copied a new VMImage, without undoing the pending changes (which are currently showing in Source Control Explorer).
One of my team members wants to checkin a new version of that particular file. Now, I need to undo my pending changes.
It sounds like you have them checked out under a different workspace. Try going to View->Other Windows->Source Control Explorer, then open the Workspace dropdown near the top of the screen, and select "Workspaces..."
I would suggest simply deleting any extra workspaces shown.
Steps to reproduce:
Make non-conflicting edits to files in TFS.
Get the latest version of the project from source control.
Sometimes, pending changes will be marked as non-pending and all project files are saved, resulting in no pending changes in the Team Explorer.
Workaround:
Right-click on the solution folder in source code explorer
Select "Compare"
In the search results, manually open files which have been edited/added and save them. This will register them as a "Pending Change" in team explorer.
This is because TFS apparently uses file properties rather than actual text comparisons to register pending changes in Visual Studio.
Tested on: Windows 7, Visual Studio Ultimate 2012.
Additional feedback from my supervisor: "Not sure if it was the issue this time, but that can happen when you disconnect from the TFS server (which sometimes happens without it being obvious). File | Source Control | Go Online usually fixes it (and the option isn’t available if you are online)."
TFS is buggy everywhere. i think you need to check out the parent folder and use TFS power toys to undo all the rubbish unchanged item.
TFS use file property to indicate whether or not a file has change, which sucks the most, and produce tons of usability problem.
If the file that you checked out is not part of the current solution, it might be hidden by the "Filter by solution" toolbar button on the Pending Changes window.
Get your changed files check out for edit
I had the same problem, I re-started VS, opened the solution and all the changes are now being displayed in the pending changes window.
Did you try to checkout the file from the Source Control Explorer view ?
For me, it worked.
I have just had a similar issue in VS2012.
To resolve the issue, I toggled the "Show xxx" dropdown to "Show Solution Changes" and then back to "Show All". The files that were missing from the list then re-appeared.
I was having a similar problem and it was due to the fact that my local version was a "non-version control solution" for some reason! meaning that my local was not really connected to the actual source code on tfs.
fix: Got the latest with override option checked. I know this could be painful if you had a lot of changes made to your local.
I was facing same issue the first answer was really helpfull. But make sure to check "Show Remote Workspaces" if you are working from different computer. In my cases the files where checked in and edited from home computer and it was showing pending changes. Deleting unwanted workspaces helps to solve this problem.
a different workspace on the same machine
a different workspace on another machine
TeamExplorer -> PendingChanges -> Excluded Changes ( I included this only because you didn't specifically mention they weren't there)
especially if you right clicked a node in solution explorer and chose check-in
Filtered based on TeamExplorer Settings #Oliver
Use a Tfs Query to find the pending changes and what workspace they are pending from.
Another option is to permanently or temporarily give them permissions to overwrite your lock. Then he can check-in anyhow.
I've seen this problem. Sometimes when I have the pending changes window in 'flat display mode', it doesn't display my changes. I find if I click the toolbar icon at the top of the pending changes window with tooltip 'Change to folder view', then they display. I think this is a bug in the Team Explorer Client.
sometimes I can not lock a branch because users have things checked out, but when I ask them about it, the pending merges/changes, only folders come up with no objects to change. What's with that?

Resources