We use a batch file to generate code, and it automatically checks out the generated files from Team Foundation Server (TFS) so that it can regenerate them. The majority of t
Visual studio will know if the checked out file has changes or none.
WARNING: This method also removes new files, i.e. files that are not yet checked in to TFS. If you want to keep these files then simply exclude them from the set of files you "undo".
Beware that TFS undo will not revert back the File System's "Date Modified" value. This is very frustrating especially if you use tools like robocopy to sync up remote machines. Even after you undo your check out, if you saved the file thereby updaing the "Date Modified" value, that updated value will stick around even after an undo checkout.
I can see Ray LionFang's approach above. Can't comment there since I don't have the rep. While I like this approach since there's no changes required to Tools etc........
- Right-click on your project
- select undo checkout, then just click okay, or whatever confirmation is left...
- then, while undoing checkout, for every file that has REAL changes in it, a prompt will ask you to confirm the check out for that file... simply click "No to All"
- Visual studio will know if the checked out file has changes or none. Be aware that this method also removes added files that are not yet checked in from TFS...
.......there's a problem with that approach in that hitting "No To All" retains a few files which are not modified. It seems to do something like Undoing unmodified files until it hits the first file that's actually modified and then ignores the rest of the unmodified files, if that makes any sense. I've only seen this effect once in a while.
A potential work-around is to follow the above process but instead of hitting "No To All", hit "No" for each file. Since this can take a while depending on the number of files you're working with, what I normally do is to hold down "ALT + N", and it just speeds through all the files while undoing ALL unmodified files.
Thank you @mike & @ray,
I wish to make it easier.
In VS, at Tools menu, click on "External Tools".
Click Add.
Enter title.
Command: tfpt.exe
Arguments: uu . /noget /recursive
Initial Directory: [you can choose from the arrow button].
Two new command are added to Tools menu.
Use them when needed.
Enjoy,
Ofir