How to have TFS 2010 detect changes done to files outside of Visual Studio?
Solution 1
If you have a network connection to your server while you're working outside of Visual Studio, it's probably best to go ahead and check the file out before editing it, either using the tf command line client, or using the Windows Explorer shell integration that's available in the TFS Power Tools release. (Plus an increasing number of other tools have TFS integration that makes this automatic, but if you're just using notepad, this still needs to be a manual step.)
Of course, there are many times when you're working and you don't have a network connection available that allows you to check out the files.
If you know what files you've modified, you can just check them out from within Visual Studio, then you'll be able to check them back in.
If you don't know what files you've edited, you can detect the changes by running the tfpt online
command (also part of the Power Tools release). This will locate the files that have been modified locally and check these files out from the server.
Solution 2
TFS has a "Reconcile" command for this:
- Open the Source Control Explorer
- Right-click on the folder with the changes and choose Compare
- Select the files you want to reconcile (press CTRL+A to select all files)
- Click on the Reconcile button
- Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check Out
- Click OK
- If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
- Click Check Out
See also: Reconcile differences between folders
Solution 3
This worked for me, using the TFS Power Tools:
tfpt online /adds /deletes /diff /noprompt /recursive directory-name
(where directory-name is the path to the directory to be updated, otherwise it will detect changes throughout your entire TFS repository)
If you want to know what it would do without it actually making any changes, you can force it to do a dry run by adding the /preview
switch.
Solution 4
*1- make changes outside of Visual Studio
2- go to Visual Studio and open Source Control Explorer
3- right click on the folder > "Check Out for Edit" > "Check Out"
4- right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"*
I tested this workaround on a branch and it helped me a lot. But there are only new files and new folder who has to be done manually.
I recommend to create a branch before the operation. It isolates you the time of the operation.
Note: This technique does also the files identical cleanup that TFS always marks as modified.
Solution 5
Try this. It's some sort of workaround, but it works:
- make changes outside of Visual Studio
- go to Visual Studio and open Source Control Explorer
- right click on the folder > "Check Out for Edit" > "Check Out"
- right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"
That's it. The changes are visible now.
Admin
Updated on July 07, 2020Comments
-
Admin almost 4 years
I'm using Team Foundation Server 2010 with Visual Studio 2010.
Whenever I modify a file outside of Visual Studio, TFS doesn't seem to detect the change done to the file, and thus doesn't offer me the option to check-in the file after it has been modified.
How can this be solved?
-
Edward Thomson about 13 yearsI'd really recommend against this - my biggest worry would be that I'd fat-fingering this one and accidentally undoing all my legitimate changes. In addition, you're checking out all the files which, depending on your client and server configuration, will probably take a lock on some or possible all files and could do a get latest on check out which could certainly be annoying.
-
Edward Thomson over 12 yearsThis should really be a comment on alga's post, not a new answer. In any case, I'd still recommend against doing this for the same reason I recommended against it when alga suggested it above.
-
iOnline247 over 11 yearsThanks for the tip @Adam Batkin. Worked like a charm and I'm now fixed up! +1
-
Steve B about 11 yearsBeware, this command line will also include unwanted files: *.user, BIN\, obj, etc...
-
Mike Gledhill over 10 yearsUtterly brilliant ! Exactly what I was looking for (after our company moved our TFS server, and TFS/VS2010 were baffled by it). Now, I just have my edited files checked out. Thanks!
-
user2173353 over 9 yearsThis works, but MS should provide better ways to do this. Command line and hacks should not be necessary on a good product (especially if this is embedded into VS). SVN and Mercurial do this for fun...
-
NickH over 9 yearsThis is the best answer as it does not require the command line or a risky 'Undo pending changes'.
-
Mark K Cowan over 9 yearsCheers, I was looking for a command line way so I can automate updating the company's TFS from my local Git repo!
-
Kresimir Pendic about 9 years@SteveB there is a
/exclude:fld_name/*,filename
switch that can be used for excluding unwanted files .. that halped me alot -
Gilad Barner about 9 yearsSaved my day! I followed your steps precisely and it worked exactly as expected. :-)
-
Dzmitry Lahoda almost 9 yearsI run like this
tfpt online /deletes /noprompt /recursive directory-name
and got thousand files to be `changed`, so have to undo. But I never ever touched these, just deleted folder. -
Nicolas over 8 yearsWorked as described. Should be the best answer.
-
kraftwer1 over 8 yearsUnfortunately, when doing this over my whole project, I get the error The specified path, filename, or both are too long. The fully qualified name must be less than 260 characters, and the directory name must be less than 248 characters. Selecting individual folders is not an option for me, because I cannot remember all the files directories that I have changed. Any idea?
-
mhu over 8 years@kraftwer1: Try moving your workspace to a folder with a short name in the root of the drive (for example
C:\TFS
) -
mhu over 8 yearsI'm afraid you need to tweak your folder/path structure first then.
-
Nicolas Leucci almost 8 yearsWorking perfectly in VS 2015 update 3, thanks a lot. Should be the best answer, no tricky commands to make it works
-
23W over 7 yearsWhy no the delete command for the files that on server only (not in your workspace) ?
-
Mark Avenius over 7 yearsRunning
tfpt uu /noget
after this will undo unchanged files too ;-) -
CincinnatiProgrammer almost 7 yearsI now have over over 750 marked changes instead of 15 or so, not sure how this worked for everyone? I can't check this in and have to dig through and undo changes on almost everything!
-
Matt over 6 yearsInstead of point 4, you could use tfpt uu stackoverflow.com/a/544285/10245
-
Stefan Steiger over 6 yearsWhy does it lack the option "replace server version with local version" ... incredible crap.
-
MyNameIsKo over 6 yearsUsing VS2017, I no longer have a Compare option when right clicking a folder. This only seems to be available on files.
-
mhu over 6 years@MyNameIsKo: docs.microsoft.com/en-us/vsts/tfvc/…
-
Eduard Jacko about 6 years@CincinnatiProgrammer I had same issue, but you can filter solution changes in Team explorer. 1. exclude everything. 2 in Exclude Changes tab change view options to "show solutions changes". Hopte that helps
-
Kyle Delaney almost 6 yearsVisual Studio doesn't seem to detect changes to files just by checking them out. I just tried checking out a folder and the contents showed up in pending changes as edits. Then I deleted the folder in File Explorer and refreshed the pending changes but Visual Studio didn't say the files were deleted in pending changes. Also, the files were still present in Solution Explorer.
-
Kyle Delaney almost 6 years"Compare" still didn't detect that I had deleted one of my local folders. It just noticed that the folder and its contents were checked out for editing. The "Reconcile" button along with most of the other buttons were grayed out.
-
Kyle Delaney almost 6 yearsThis just undoes what you did. It doesn't make Visual Studio aware of what you did.
-
Kyle Delaney almost 6 yearsThis just undoes what you did. It doesn't make Visual Studio aware of what you did.
-
Richard almost 6 yearsThis seems worth noting, when I did this, TFS showed all new changes in existing files but did not pick up any newly created files.
-
Christian about 5 yearsAnd if you created or added new items, in that session: Gone baby, gone!
-
David V. Corbin over 3 yearsVS-2019 Does not seem to have reconcile... PowerTools appear to be gone in the new world of Azure DevOps....