You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何创建Visual Studio外部工具以执行TFS的‘Add Items to Folder...’命令?

How to Create a Visual Studio External Tool for TFS 'Add Items to Folder...'

I’ve set this up for my own team before, so here’s a straightforward, step-by-step guide that works for Visual Studio 2019 and 2022:

Step 1: Open External Tools Settings

  • Launch Visual Studio
  • Head to the Tools menu, then select External Tools... (if it’s missing from the main Tools menu, check under Tools > Options > Environment > External Tools — the direct menu entry is usually enabled by default)

Step 2: Configure the New Tool

Click the Add button to create a new tool entry, then fill in these fields:

Title

Give it a clear, recognizable name like *TFS Add Items to Folder* (the asterisks help it stand out in the Tools menu)

Command

You have two solid options here, depending on whether you prefer the Visual Studio UI dialog or the TFS command-line prompt:

Option A: Trigger the Visual Studio UI Dialog

Use the Visual Studio executable to run its built-in command:

$(DevEnvDir)devenv.exe

Option B: Use tf.exe with a Selection Prompt

Use the TFS command-line tool directly (great for folks who prefer CLI workflows with a prompt):

$(DevEnvDir)CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe

Arguments

Match the arguments to your chosen command:

For Option A (UI Dialog):

/command "Team.AddItemsToFolder"

This tells Visual Studio to launch its native "Add Items to Folder" dialog — the same one you’d get from right-clicking in Solution Explorer.

For Option B (tf.exe Prompt):

add "$(SolutionDir)" /recursive /noignore /prompt
  • $(SolutionDir) targets your current solution’s root (swap this with $(ItemPath) if you want to target the item currently selected in Solution Explorer)
  • /recursive includes all subfolders
  • /noignore bypasses .tfignore rules (remove this if you want to respect ignored files)
  • /prompt opens a dialog to pick exactly which items to add

Initial Directory

Set this to ensure the tool runs in the right context:

$(SolutionDir)

Optional Checkboxes

  • Check Use Output Window if you want to see command logs in Visual Studio’s Output pane (handy for debugging if things break)
  • Skip Prompt for arguments unless you want to tweak parameters every time you run the tool (not needed for most use cases)

Step 3: Save and Test

Click OK to save the tool. Now you can run it from the Tools menu — it’ll either open the familiar "Add Items to Folder" dialog or prompt you to select items via the tf.exe interface, depending on your setup.

Quick Troubleshooting

  • If tf.exe isn’t found: Double-check the path — it varies slightly by Visual Studio edition (Community/Pro/Enterprise) and install directory. You can locate it manually by navigating to your Visual Studio install folder, then Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.
  • If the UI command fails: Confirm you’re using Team.AddItemsToFolder — this is the valid command name for recent Visual Studio versions.
  • Permissions issues: Make sure you have TFS permissions to add items to the target folder.

内容的提问来源于stack exchange,提问作者Joseph Schreifels

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 02:57:34