This documentation is archived and is not being maintained.

Options Package Sample (C++)

Visual Studio 2005
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The Option Package sample contributes a page to the Options dialog box on the Tools menu. Choosing this page on the dialog box allows the user to type a text string that is persisted upon exit. The purpose of the sample is to demonstrate how to contribute UI to the Tools Options dialog box in Visual Studio and how to persist any data that may be entered there.

The default location for the Options Package sample is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Archive\ OptPkg.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build this sample

  1. Start Visual Studio. Type devenv.exe at the command line.

  2. Open the OptPkg.sln file within Visual Studio.

  3. On the Build menu, click Rebuild Solution.

  4. Run devenv.exe /setup /rootsuffix exp to merge command bars and other UI items.

    devenv.exe /setup /rootsuffix exp

To run this sample

  1. Start Visual Studio using the experimental build by typing devenv.exe /rootsuffix exp at the command line.

    devenv.exe /rootsuffix exp

  2. On the Tools menu choose Options. The Options dialog box appears.

  3. In the folder list, open the Options Sample Package, and select General.

  4. Enter any text into the Options Package Setting field and click OK to persist the text.

  5. Repeat steps two and three to view the persisted option value.

    After you have built the sample, you have provided a page to the Options dialog box.

The following table lists the interfaces that are implemented by the Options Package sample.

Implemented Interfaces




The following table lists the interfaces that are called by the Options Package sample and their associated services.

Called Interfaces Associated Services









The following table lists the important files used when implementing Options Package.

File name Description


Standard IVsPackage implementation of in COptPkgPackage.


Registers the VSPackage.

See Also

Other Resources

VSPackage Samples