How to: Create an Editor (C#)

The Visual Studio Integration Package Wizard creates a boilerplate implementation of a simple VSPackage given the company name, the VSPackage name, and the VSPackage version number. The wizard can also add code to the VSPackage to create a simple editor.

To create a VSPackage using the Visual Studio Integration Package Wizard

  1. On the File menu, point to New, and then click Project.

  2. In the New Project dialog box, expand Other Project Types, and click Extensibility Projects.

  3. In the Templates pane click Visual Studio Integration Package.

  4. In the Location box, type the file path for your VSPackage.

  5. In the Name box, type the name for the solution and click OK to start the wizard.

    On the Select a Programming Language page, select C#. Have the wizard generate a key.snk file to sign the assembly. Alternately, Browse to your own key file. The wizard makes a copy of your key file and names it key.snk.

  6. Specify details about your VSPackage in the Basic VSPackage Information page. Provide the VSPackage name, the name of your company, and the version information in the respective boxes. The VSPackage name is written into the system registry. It can also appear in the Help About dialog box, and on the Visual Studio splash screen. The version information is written into the registry and can appear in the Help About dialog box.

    1. Click the Change Icon button to select an icon for the splash screen.

      Select an icon from the Change Icon dialog box, or browse to an ico file in another location. Only ico files are supported.

    2. In the Detailed Info box, type additional information that you want to display in the Help About dialog box.

    3. Select the minimum edition of Visual Studio you want your VSPackage to support.

    4. Click Next to specify options for your VSPackage, or click Finish to create a boilerplate VSPackage.

  7. Select the Custom Editor option to create a custom editor for your VSPackage. When the Custom Editor option is selected, the Editor Options page is displayed.

  8. Type the name of your editor in the Editor Name box. Type the file extension that you want to be associated with your editor in the File Extension box. Your editor is available to be a Visual Studio editor for files with this extension. The file extension is registered in the Visual Studio integrated development environment (IDE) only and not in the larger Windows environment. Type the default file name for new documents created with your editor in the Default File Name box. Click the Change Icon button to select, or browse for, an icon that is associated with your editor window and your new editor file type.

  9. Click Finish to create your VSPackage in the folder that you specified.

To test your custom editor

  1. On the File menu, point to New and then click File.

  2. In the Categories pane of the New File dialog box, select the file type you generated with the Visual Studio Integration Package Wizard.

  3. Click Open to view and edit the document.

    The editor supports cut-and-paste, find-and-replace, and open-and-load operations.

Compiling the Code

Projects generated with the wizard have embedded paths that refer to utilities like Regpkg.exe. To use them on another machine, you need to ensure the paths match.

See Also

Other Resources

VSPackages