Programmatically change Visual Studio Options

2019-09-06 14:27发布

问题:

How do I programmatically set and unset Visual Studio Options?

I have done the research and troubleshooting and found it is not possible, ironically now I find myself needing this functionality.

Here is a question I answered specifying why its not possible to programmitically click buttons in the VS Options Dialog: Programmatically reset VisualStudio shortcuts.

I dont need to click a button, I need to change a boolean setting as per screenshot.

Please... if you have any undocumented methods.. please help me. It will improve every developers life, particularly newbies.

回答1:

Just use:

dte.Properties["Debugging", "General"].Item("EnableExceptionAssistant").Value=false;

Most of the options can be retrieved and set this way. See also:

Options Page, Debugging Node Properties

HOWTO: Getting properties from the DTE.Properties collection of Visual Studio .NET.



回答2:

You'd have to write code to change the following registry key.

HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\ApplicationPrivateSettings\_metadata\revisions\Microsoft\VisualStudio\Platform

TitleCaseMenus is the node you're after :)

You may need to change the Visual Studio version number depending on what you have installed.

Edit: For your new pic the registry key is here: HKCU\SOFTWARE\Microsoft\VisualStudio\14.0\Debugger\UseExcept‌​ionHelper