Force TFS to detect changes

2019-03-22 12:39发布

问题:

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?

回答1:

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.



回答2:

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



回答3:

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

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 ^^



回答4:

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.



回答5:

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



回答6:

In Visual Studio 2015:

Source Control -> Advances -> Refresh Status



回答7:

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.



标签: tfs tfs2012