Package.AddOptionKey Method

Adds a user option key name into the list of option keys.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

protected void AddOptionKey(
	string name


Type: System.String

The name of the option key to add. An option key name must not have any periods in it.

The AddOptionKey method adds a user option key name into the list of option keys that the package stores in the solution file. To save package data in a solution file, perform the following tasks:

  1. Call AddOptionKey in your package constructor for each option key you want to store.

  2. Override OnLoadOptions and OnSaveOptions and implement your save and load logic for each key. OnSaveOptions is called for each key you have added. OnLoadOptions is called for each key in the solution file.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft