Creating a Wizard

Wizards, such as the Add-in Wizard, are a type of automation client that leads a user step-by-step through a series of actions to accomplish a complex or difficult task and, once completed, goes away. Wizards are created using the IDTWizard interface and have only one method, Execute, which contains the code you want the Wizard to run. A Wizard can be programmed to create a fully working application for the user, or a skeletal application that the user needs to add additional code to for it work correctly, such as with the Add-In Wizard.

For additional information about creating wizards for Visual C++ .NET, see Designing a Wizard and Creating a Custom Wizard.

Wizards can be constructed to appear any way you like. They consist of one or more windows, or panels. Panels can contain a descriptive image, such as to the top or left side of the panel, a label description, instructions, and an area in which navigation controls such as Next and Previous can be placed.

A Wizard Panel

The wizard, when completed, is available as a template in the New Project and New File dialog boxes.

To create a Wizard

  1. Create a new DLL project.
  2. In the class module, implement the IDTWizard interface.
    Implements IDTWizard
  3. Add the code you want to the Execute procedure.
  4. Open the Project Properties dialog box (right-click your project in Solution Explorer and select Properties) and set Register for COM interop to True. (This option is located under Configuration Properties / Build / Outputs.)
  5. Compile the project. If you used Visual Basic .NET or Visual C# .NET, this creates a .NET framework component dynamic link library (DLL).
  6. If you created a Visual Basic .NET or Visual C# .NET wizard, you must also register the component using regasm. See Add-In Registration for more information.
  7. Create a .vsz file for the Wizard. This allows the Wizard to appear in the New Project or New File dialog boxes. For more information, see VSZ Files.
    Note   Optionally, you can create a VSDIR file for the Wizard. This contains the information that displays as a description for the Wizard in the New Project or New File dialog boxes, and allows you to specify an icon and arrange its location in the list. For more information, see VSDir Files below.

At this point, you can run the Wizard by choosing Add from the New option on the File menu and then choosing either the Add Project or Add Item command.

To display a custom icon for the new wizard, either specify a path to the icon (.ico) file in the VSDir file or place an icon file in the same directory as the wizard file with the same base filename as the .vsz file, but with an .ico extension. For example, if the Wizard is called MyWizard.dll, name the .ico file MyWizard.ico.

See Also

Automation Object Model Chart | Creating Add-Ins and Wizards | Creating an Add-In | IDTWizard Interface | Visual Studio Commands | VSDir Files | VSZ Files