6

Is there a file somewhere that I can use to do massive changes to the context menu in an easier fashion?

The GUI:

enter image description here

gives me no way to move a command from one menu to another, nor does it let me see what the command actually is (in order to add that same exact command to another menu), thus I don't have much to work with.

And thus I am seeking a file (or a gigantic registry key? ugh.) that I can edit somewhere else where I have more powerful tools. (my VS version is Enterprise 2017 if that matters)

NH.
  • 2,240
  • 2
  • 23
  • 37
  • 1
    Perhaps [this](https://msdn.microsoft.com/en-us/library/zbhkx167.aspx) might be useful? Apparently the settings are stored in '%USERPROFILE%\Documents\Visual Studio 2015\Settings'. However, after a quick glance, it appears that maybe only changes from the default are saved there. – Rob Mar 07 '18 at 23:29
  • or I might have to use resmon to find the file... (note to self) – NH. Mar 07 '18 at 23:33
  • It seems to get stored in a giant, complex XML file filled with GUIDs and magic numbers where @Rob pointed to: "Documents/Visual Studio 2017/Settings/CurrentSettings.vssettings". It looks like the customizations are contained within a `` tag. It might make it a bit easier to export just the "Menu and Command Bar Customizations" to it's own XML file, then edit that and import to see if you did your edits correctly. But I don't think it would be a simple job to make any significant edits by hand. – Michael Burr Mar 08 '18 at 00:42
  • Thanks @MichaelBurr, but it looks like it doesn't show the whole menu, only the things that have changed. Getting pretty close though (if only I can figure out how to find the GUIDs I need)... – NH. Mar 08 '18 at 18:10

1 Answers1

5

You can find the defaults at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Profiles, with a general settings and some language-specific overrides. There's an additional override in IDE\VC\Profiles as well.

In my case, I wanted to move 'Start new instance" on a Project into the top-level context menu. So I:

  1. Made a copy of CurrentSettings.vssettings
  2. Added a new command where I wanted it (via the Tools > Customize... GUI)
  3. Found the command I wanted to clone and moved it up one
  4. Closed VS (it saves on exit)
  5. Compared the two files to find the diffs (use your favorite tool.) You'll find them under Category[@name="Environment_CommandBars"]\CommandBars\UserCustomizations as add remove and modify entries
  6. Took the Cmd attribute from the moved entry and pasted it over the added one (it was Cmd="{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}:00000164" for me, to save interested parties a few steps)
  7. Undid the move to retain only the added entry

I wasn't able to find a command entry for this anywhere in the defaults, so had to figure it out the hard way.

John Neuhaus
  • 1,784
  • 20
  • 32