Skip to content
| Marketplace
Sign in
Visual Studio>Tools>kbFindInFolder
kbFindInFolder

kbFindInFolder

wartickler

|
436 installs
| (3) | Free
Select one or more folders in the Solution Explorer, select right-click, and choose the "Find in Selected Folder(s)" menu item. This will open the "Find in Files" dialog with the selected folders already entered in the "Look in:" field.
Download
C#
Edit|Remove
csharp
protected override void Initialize()        {            base.Initialize();            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;            if (null != mcs)            {                CommandID menuCommandID = new CommandID(GuidList.guidkbFindInFolderCmdSet, (int)PkgCmdIDList.cmdidkbFindInFolder);                MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID);                mcs.AddCommand(menuItem);            }        }        private void MenuItemCallback(object sender, EventArgs e)        {            var dte = (DTE)GetService(typeof(DTE));            var selectedItems = dte.SelectedItems;            String[] paths = new String[selectedItems.Count];            Int32 i = 0;            foreach (SelectedItem selectedItem in selectedItems)            {                var fullPath = selectedItem.ProjectItem.Properties.Item("FullPath").Value.ToString();                paths[i++] = fullPath;                //MessageBox.Show(fullPath);            }            dte.Find.SearchPath = String.Join(";", paths);            dte.ExecuteCommand(@"Edit.FindInFiles");        }
protected override void Initialize()         {             base.Initialize();              OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;             if (null != mcs)             {                 CommandID menuCommandID = new CommandID(GuidList.guidkbFindInFolderCmdSet, (int)PkgCmdIDList.cmdidkbFindInFolder);                 MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID);                  mcs.AddCommand(menuItem);             }         }          private void MenuItemCallback(object sender, EventArgs e)         {             var dte = (DTE)GetService(typeof(DTE));              var selectedItems = dte.SelectedItems;              String[] paths = new String[selectedItems.Count];             Int32 i = 0;              foreach (SelectedItem selectedItem in selectedItems)             {                 var fullPath = selectedItem.ProjectItem.Properties.Item("FullPath").Value.ToString();                  paths[i++] = fullPath;                 //MessageBox.Show(fullPath);             }              dte.Find.SearchPath = String.Join(";", paths);             dte.ExecuteCommand(@"Edit.FindInFiles");         }
 

I looked all over for an extension that lets you select the folder(s) you want to search in and brings up the Find in Files dialog. I'm surprised if I'm the first to write one....

Select one or more folders in the Solution Explorer, select right-click, and choose the "Find in Selected Folder(s)" menu item. This will open the "Find in Files" dialog with the selected folders already entered in the "Look in:" field.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft