47

Seems like this should be something very simple, but I can't find how to do this...

I made a changes to several files spread within a repo by using a script that I wrote. Problem is TFS in its infinite wisdom does not think the files have changed. Aside from manually finding each file and clicking "checkout for editing" is there any way to tell TFS to just rescan everything and detect changes?

Ilia G
  • 10,043
  • 2
  • 40
  • 59
  • 4
    Duplicate question: http://stackoverflow.com/questions/5899213/how-to-have-tfs-2010-detect-changes-done-to-files-outside-of-visual-studio – Morten Frederiksen May 02 '13 at 14:01
  • 1
    Good answers, but switching to local vs server workspaces would be even simpler. – Andrew Clear Jan 09 '15 at 18:50
  • Does this answer your question? [How to have TFS 2010 detect changes done to files outside of Visual Studio?](https://stackoverflow.com/questions/5899213/how-to-have-tfs-2010-detect-changes-done-to-files-outside-of-visual-studio) – Ian Kemp Jun 30 '20 at 14:57

8 Answers8

27

A Folder Compare (File->Source Control->Compare...) should do the trick. Select the top folder from where to start comparison, and select to compare with Latest Version. The result hould show files that are changed, and whether they are checked out or not.

Torbjörn Bergstedt
  • 3,359
  • 2
  • 21
  • 30
  • 3
    Funny, when i do this folder compare in VS 2012, it says TF10108: Source control cannot compare a file with a folder. Select two files and try again. – arviman Apr 16 '15 at 06:33
  • @arviman: The second path needs to be a file. This is not a viable solution when you have changed hundreds of file in a project outside of Visual Studio. – damd Apr 07 '16 at 08:07
  • Yes, it will show, now have 80K files wich are ranomly added/edited/deleted, but pending chages have not been made... – David V. Corbin Feb 04 '21 at 15:35
20

TFS has a "Reconcile" command for this. See https://stackoverflow.com/a/22860674/932282 for a complete answer.

Community
  • 1
  • 1
mhu
  • 17,720
  • 10
  • 62
  • 93
15

Local Workspace

You need to work with a local Workspace. Here's how to manage workspaces:

visualstudio.com: "Create and work with workspaces".

When adding or editing the workspace you click Advanced >> . Then you set Location: to Local.

Now when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.

It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes

Detected adds under Pending Changes in Team Explorer

BUT BE CAREFUL. When adds or deletes get detected and you add them to your Pending Changes, the files aren't automatically included to your project. So you maybe check them in to TFS, but they aren't listed under the Solution Explorer.

Matt Burke has a fix for that problem:

mattburkdev.com: "Automatically Include All Files in Folder in Visual Studio"

To edit the Project file you rightclick your project, chosse Unload Project, then rightclick on it again and choose Edit. After you edited the project files save and close it. Then rightclick and chose Load Project.

But with that you also need to be careful, because the Project only searches for new files in these folders to include, when you load the project and not while you have the project open. So when some files get added outside Visual Studio, you just reload the project.


Server Workspace

But if you have to stick to a Server Workspace for some reason i got another trick for you:

FIRST: Check out all Files that maybe have pending changes (better check out many files). Then go to Team Explorer -> Pending Changes and choose all files you just checked out. Then choose "undo changes". After this you get a message "Confirm Undo Checkout". This message ONLY pops up for the files, which actually HAVE changed! Press "NO" for each files or "No to All".

FINALLY: Under pending changes all files get removed from the list except the ones which have pending changes.


I hope I could help someone and you didn't have to search for this solution as long as I had to ^^

Silv
  • 673
  • 5
  • 19
  • I wish I had read this before I got fed up and just checked out my whole project then checked back in EVERYTHING which took some time. I had deleted the project contents then pasted in a modified version from elsewhere, and it refused to detect changes. Maybe this would have worked. – Methodician Jul 09 '16 at 17:35
  • Thanks! This is really an FAQ for everyone coming from git. You must love this feature: "You can quickly begin editing a file when your network connection is unavailable or unreliable", .. " When you add or delete files outside of Visual Studio, the program automatically detects these changes". Hard to imagine to use it any other way except for the most trivial project. While the docs say, *local* should be used in most cases, it apparently isn't the default even in VS2019. – sebkraemer Nov 12 '19 at 13:32
  • Local workspaces are fairly inperformant, big warning against anyone that has a monorepo setup. – Ryan Leach Aug 12 '21 at 07:57
5

If any of your changes occured when you were offline, you can go to File > Source Control > Go Online, and all files will be checked for modification.

heneryville
  • 2,853
  • 1
  • 23
  • 30
3

If none of the above work, you can also try to rebind your projects by going to File -> Source Control -> Advanced -> Change Source Control.

arviman
  • 5,087
  • 41
  • 48
  • Just clicking "Unbind" immediately followed by a "Bind" fixes this for me. This is the simplest solution, but it's not clear why it happens in the first place. – Jason Honingford Jul 12 '18 at 16:30
3

In Visual Studio 2015:

Source Control -> Advances -> Refresh Status

Source Control -> Advances -> Refresh Status

Orhan
  • 420
  • 1
  • 6
  • 12
0

I had this problem a while age when i moved project from one pc to another. the solution was to remove temporary files that TFS had created in solution folder. Delete .vs and hidden $tf folder.

If no luck,on your local PC copy your solution folder to another, remove all files inside solution, get latest version from TFS server ,then from the copied folder just grab neccessary and edited files and put them back to solution folder (this will overwrite some files).

After all don't forget to check project mappings and if everything seems correct try right clicking on solution and 'Add to source control' option.

AmiNadimi
  • 5,129
  • 3
  • 39
  • 55
0

Dtsx file dropped in TFS folder was not being recognized.

  • On your Visual Studio (2015) home screen, click on the Team Foundation Server link. Make navigate to the correct branch.
  • On the window on the left side of the screen, navigate to the folder that contains your file. Expand the folder.
  • To the right of the folder you will see three dots. Click on those and then click on “ + Add File(s)”.

Choose “Upload Existing Files”. Then you can drag and drop your .dtsx files into the window and then click Okay.

Finally, you’ll have to do a ‘Fetch’ to add the files there. Then you need to do a ‘Pull’. Lastly, you can commit the change to remote branch.

Obsidian
  • 3,719
  • 8
  • 17
  • 30
Jairo Kariuki
  • 61
  • 1
  • 1