Undo checkout on unchanged files (TFS)
One thing that drives me crazy with TFS is the fact that if you have a file checked out, but you made no changes to it, it still shows as a change, distracting you from real changes that you made. This is especially annoying when you use tools such as T4 to generate code, because most of the time the tool will generate the same code, but will leave the file checked out.
For some reason that I can’t understand, Visual Studio insists in showing those as changes, and will even claim that there are conflicts if another person happened to check-in the same “changes”.
Fortunately, the TFS Power Tools include a command that compares checked-out files with the server version and undoes the unchanged files. I will explain how to integrate it into Visual Studio using a custom tool.
Integration into Visual Studio
First we need to install TFS Power Tools. Simply go to the download page and install it from there. Once it is done, we need to create a custom tool to run it.
In Visual Studio, go to the Tools/External Tools menu. In the dialog that appears, click on Add, then enter the following values:
Field | Value |
---|---|
Title | &Undo fake changes |
Command | %windir%\System32\cmd.exe |
Arguments | /C echo y | “%ProgramFiles(x86)%\Microsoft Team Foundation Server 2010 Power Tools\TFPT.EXE” uu /recursive /noget |
Initial directory | $(SolutionDir) |
UPDATE: Do not check “Use Output Window” because that prevents TFS Power Tools from prompting you for your credentials.
In order to run the command, go to Tools/Undo fake changes.