I need to launch a tool of mine that takes two file paths as args, which I have multi-selected in Solution Explorer.
Both files are not open in edit windows and are usually in different projects as well. The only thing they have in common is being in the solution somewhere.
Question 1 - External Tools
$(ItemPath) et al only deal with a single current window, are there any variables for passing along what is currently (multi-)selected in the Solution Explorer view, or am I stuck having to make a .vsix to do that?
Example repro 1.1
- create a solution with two ClassLibrary projects on .NET Core 3.1 (doesn't really matter, just make any two projects)
- multi-select two files from the two different projects in the Solution Explorer window (the Class1.cs files do nicely)
- do not open any editor windows (just to avoid any red herrings by having windows open and taking part in associating as ItemPath, etc)
- open Tools->External Tools and Add a new one (I used WinMerge, use anything you want here)
- populate the Arguments for the added tool with ... ??? (it isn't ItemPath which is for the current editor windows in focus; it would be some var or expr representing the file paths of the two items selected in the Solution Explorer window)
Example repro 1.2
- same as previous Example repro 1.1, but Switch to Available Views and do it with Solution Explorer in Folder View instead
(because tools that only need the file paths my selections are pointing at should be able to get them from Folder View as well; there is nothing "project-y" about the file paths to files)
Question 2 - .vsix that works on multiple files selected in Solution Explorer (and in Folder View mode)
When I try a .vsix I can't make it work when Solution Explorer is simply doing folder nav in Folder View. I suspect that is because the project item model of a normal .sln isn't the same when it is merely viewing folders and files - odd considering any extension that just works on the level of passing a file path or two should also operate when you are merely using VS as a fancy file explorer.
Is there a .vsix example that shows how to build an extension that can respond properly to multiple files selected in either the regular Solution Explorer project view mode, as well as the Folder View mode?
Example repro 2.1
- create a .vsix extension project which does the following:
- add a context menu option to invoke a tool ( again, doesn't matter what - could just be echo)
- the context menu option should appear when right-clicking on files in either Solution Explorer view mode (both Project and Folder view)
- the context menu option should appear and operate on either multi-selected file, and the file(s) selected are all available within the menu option callback processing
(in both 1.1 and 1.2 Example repros above, invoking the context menu over either of the two selected files will give both files as info to use inside the callback)
I updated the post with more details on what I am trying to do and how to repro it.
Basically, I want to know how to handle multi-selected files in Solution Explorer (in either Project or Folder View modes), and get their info to either an External Tool command or a .vsix extension.
Scenario: My own diff tool that I want to hook up in all the obvious ways and places.