可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
We're using team foundation server for our source control. I frequently put files into my project (under source control) and forget to "add" them as far as TFS is concerned. There are also cases where TFS doesn't pick up new files (copy and paste a file in your project).
Is there a way I can list all of the files that have not been marked as "add" so that I can verify that all of the intended check-ins take place?
This is driving me crazy! We don't have continuous integration set up yet for this project, and I keep missing files. I don't find out until someone asks me where the file in.
In Subversion, this was dead simple.
I know one solution is to checkout a second copy, but that's not really an optimal workaround.
回答1:
You might want to make sure you have the latest version of the TFS client installed (VS 2008 SP1) as that makes it much easier to work with files. Also, take a look at the TFS Power Tools - especially the tfpt online command.
The tfpt command line has a bunch of handy TFS utilities. Once you install the TFS power tools, type "tfpt help" at a Visual Studio 2008 Command Prompt to get a list. If you do "tfpt online /r" in the root of your solution it will detect the files that are writeable in your local file system and pend adds or edits for them. You might want to limit the command so that it only looks for source files - "tfpt online /r *.cs" for example.
回答2:
Go to Source Control Explorer, right click on the folder you are interested in and choose compare.
This will show both files that are not added and also files that have been modified without checking out first.
This solution does not require Power Tools
回答3:
Yes there is. Navigate to Source Control Explorer. Click on the project you're interested in. Click the "Add Items to Folder" button. It is two over from the refresh button. This will give you a list of all files that are in the folder but not added to source control.
回答4:
'Inspired' by this answer
The TFS Power Tools
) now have Windows Shell Extensions, so you manipulate source control files using only Windows Explorer.
The option you're after is Compare with workspace version - this works recursively too, and allows one to selectively add/delete, etc. (yes, tf.exe
will probably have an equivalent)
alt text http://blogs.msdn.com/blogfiles/bharry/WindowsLiveWriter/PreviewofthenextTFSPowerToolsrelease_72E3/image_thumb_11.png
alt text http://blogs.msdn.com/blogfiles/bharry/WindowsLiveWriter/PreviewofthenextTFSPowerToolsrelease_72E3/image_20.png
回答5:
In VS 2015 this helped me to add file to the Version Control
Open "Add Items to Folder..." Context menu item in Source Control Explorer
Add necessary files
回答6:
If you're using Visual Studio, you can right-click a folder in the Solution Explorer and choose Add > Existing item
. Unfortunately, the resulting "add file dialog" doesn't automatically scope to the folder you clicked.
However, there is also a button in Solution Explorer called "Show all files". After clicking this, files not included in the project will appear and get an "include in project" context menu item. Including them will usually put them in TFS's "Pending changes" list as "added" automatically.
(Source.)
回答7:
Migrate to git, like Microsoft is doing :)
回答8:
For Visual Studio 2017, this is still a problem, but easily repaired:
Navigate to : SOLUTION EXPLORER
second button to right of REFRESH circular arrow is: SHOW ALL FILES
Click that
All your files will appear faded out, but visible. Right click on each one and select "INCLUDE in PROJECT"
when your all done, snail Mail a letter of complaint to Microsoft