TFS - list with Missing files - tfs

Let's consider this scenarion: In case that I sinchronize my local folder with latest version at Team Foundation Server 2010 and after that manually delete some local file. My question is how I can force TFS to show me Missing files? (Source Safe would show Missing files in this case) For now, TFS check only file versions (not data) and if there is no change it doesn't make any other actions. In this case there is no version change and it doesn't recognize need for action.

You can perform a get specific version and check the option to download all files even if they match (second option).
See http://msdn.microsoft.com/en-US/library/ms181387.aspx for more information.

Good advice from Robaticus, you can also use the TFS power tools. You'll need to select a cutom install and make sure that explorer integration is checked.
This will add a new item to your context menu in windows explorer called "Team Foundation Server" you can use this to get latest, move and delete files. This will save the hastle of opening up Visual Studio when you just want to make a simple edit or delete.

Get out of the habit of using the file system and Windows Explorer to manipulate files. Use the Source Code Explorer to delete them. Otherwise you'll run into problems in the long run.

Related

How to check in mass changes into TFS

I have a situation where a developer made mass changes to a project outside of TFS (long story), and now we want to put those changes back into TFS (files added, removed, renamed).
Of course, TFS is not like Git; if I check out the project, then delete the files from the workspace and copy over the new files, TFS won't adapt to those changes.
I have discovered that I can do a Compare from File - Source Control, and that the Compare screen allows me to mark files as added/deleted. This helps, but is a slow process for a large project, and quite prone to human error.
So, my question is: Is there an automated way to get TFS to simply add all new files and remove all deleted ones?
I don't care about tracking history of renamed files--they can be
considered "removes" and "adds."
I have tried unbinding and rebinding the workspace; this did not work for me (or I didn't do it correctly).
I am using VS 2015, TFS 2015, and I have the TFS Power Tools.
If you are using a Local Workspace then you should be able to get latest on the workspace, then copy over all the new files in Windows Explorer which will generate pending changes and file adds.
If you go into Pending Changes in Team Explorer you will have lots of detected changes for new files etc. but you can promote them to included changes.
This isn't going to deal with file renames or deletions though so it might not be the best solution.
Alternatively you could use Reconcile Changes in Version Control
In Source Control Explorer, right-click a folder, and then click Compare.
In the Compare dialog box. select the folder versions to compare.
In the Folder Difference window, right-click the folder or file you want to reconcile, and click Reconcile.
This will allow you to choose what to add or change to version control
You might try using tfpt online. I would add the /adds /deletes /diff /recursive flags as well.
I think in almost any case you will have some conflicts/manual work to do here.
There is a blog post on a possibly similar situation that used tfpt online as well: Discover File Changes Made Outside of Visual Studio
Since I did not get to try the above suggestions, I'll post the workaround I did, in case it helps anybody else. Hopefully, the above suggestions are better than what I ended up doing.
Make sure nothing is checked out
Open solution
Team - Go Offline
Close solution
Windows Explorer - Copy latest source folder into the current source folder (Windows Explorer will do a Merge).
VS - Open solutin, select solution file
File - Source Control - Advanced - Change Source Control
if you get a message about unloaded projects, make sure all projects loaded. Click "Reload" on those that didn't.
Shift to select all project, click Bind
Do a Compare in Source Control Explorer. Manually add all new files. Manually delete all deleted files. Frown.

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.

Can't manually add files to TFS

We use Codesmith to generate some code, and when we open up the projects, the files are there, in the solution, but there is no way to check them in. The DLL compiles just fine. The only difference to the .csproj is the addition of any new files we generated.
But unlike VSS, TFS, does not detect these files. I validated this behavior by editing the .csproj manually. For some reason, the only way to add a file to TFS is through Visual Studio.
However, when I remove them from the project, and then include them, I get the usual yellow plus sign.
You can manually add files to Visual Studio, however changing your project file isn't the best way to do this. If your project is already under source control and the files you want to add are visible in the Solution Explorer window, you can simply right-click a file and select Include in project. The next time you check your code in, the items will be added.
Since you're using TFS 2010, check out the Team Foundation Server Power Tools extensions. This includes the Windows Shell Extensions which give you integration into Windows Explorer which let's you right click on files or folders and add the to TFS outside of Visual Studio. Very nifty!
Looks like it is not possible and the workaround is to batch-add all the files through PowerTools. Though this article/forum-thread is dated it appears to be helpful:
Adding CodeSmith generated source file in Team Foundation System

TFS out of sync between local and remote - how to "re-sync"?

I have a Project on CodePlex which is using TFS and I am using the TFS Plugin for Visual Studio. Now I have copied this project and worked on another PC without TFS and done some refactoring. Foolishly, I have then just used copy/paste and manual text editing to merge my changes, expecting that TFS just picks up the changes.
Apparantly, that is not the case.
Here is a screenshot of my local directory:
My Local TFS http://img259.imageshack.us/img259/2897/tfslocal.jpg
Notice how some files are missing the lock symbol - those are missing. If you look at the current TFS Tree on Codeplex, there are some files which do not exist locally anymore, i.e. WikiPlexExtensions.cs in the main folder.
Is there any way to easily tell TFS to compare my local to the remote repository and pick up the changes? I could re-add the local files using "Exclude from local project" and re-adding them, and I could create the "deleted" files as empty files just to delete them, but if I can avoid the manual messing around that would be good as well :)
The easiest way is to exploit VS 2008's "online" feature. Basically you want to set your solution offline, then bring it online while connected to the proper Codeplex server. TFS should figure out the rest.
Feature overview: http://msdn.microsoft.com/en-us/teamsystem/bb898913.aspx
Tweaking the settings by hand: http://blogs.msdn.com/benryan/archive/2008/07/09/using-tfs-2008-power-tools-to-modify-server-s-offline-state.aspx
To compare local and server folders, you can check out TFS Power Tool. After installing it, you can bring up the source control explorer, right click on the server folder and then select 'Compare'. Folder difference window will display the differences. You can also right click on the differences to see available commands such as 'Get Latest' to update your local folder for example. Check out Bryan Harry's blog post on the power tool
I don't think there is an easy fix... What I've done in the past is back up those files that I have edited, then do a "Get Latest Version..." for the files I edited. This should change the files back to being read-only etc... Now, check out the files the regular way and paste the backups you had into the checked out files. Obviously this really only works when there are a couple of files you have edited.
TFS (in Visual Studio) has a "Reconcile" command for this, see Microsoft documentation, or this answer with steps.
BTW: This command may not haven been existing at time of original question, but this question came first when I was searching.

Edit-Merge-Checkin with TFS

Does TFS support an Edit/Merge/Checkin model? It looks like we have to explicitly check out files with the source code explorer to get the readonly bit switched off. I'm use to files being write enabled, and just having to do a merge before checkin. Is that model supported?
Yes. It does.
Right click on the TFS project and select Team Project Settings > Source Control ... From there you can enable multiple check out.
That said, you still have to use the source control explorer to check out the file; unless you are using Visual Studio to edit it at which point, VS will automatically check out the file.
If you need to use it outside of the source control explorer, you can download the TFS Power tools which adds context menus to the regular file explorer for check in / out / etc.
Yes it does, but it is not as confortable as with SVN, you still have to use the source control explorer to check out the file, that will change with TFS 11 and Local workspaces

Resources