Delen via


Context Parameters for Launching Wizards

Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions. For more information about upgrading, see FAQ: Converting Add-ins to VSPackage Extensions.

Context parameters provide information required to launch a wizard, such as the type of wizard to be used, the name of the project, directories for wizard items, and so forth.

There are three different types of wizards:

  • NewProject — Adds a new project to a solution.

  • AddSubProject — Adds a subproject to an existing project.

  • AddItem — Adds an item to an existing project.

All three types of wizards are invoked by using the Execute method of the IDTWizard interface. One required parameter of the Execute method is ContextParams. Each type requires a different set of ContextParams values in the correct order as outlined in the following table:

Wizard Type

Parameters Used

NewProject

  • WizardType

  • ProjectName

  • LocalDirectory

  • InstallationDirectory

  • FExclusive

  • SolutionName

  • Silent

AddSubProject

  • WizardType

  • ProjectName

  • ProjectItems

  • LocalDirectory

  • ItemName

  • InstallationDirectory

  • Silent

AddItem

  • WizardType

  • ProjectName

  • ProjectItems

  • LocalDirectory

  • ItemName

  • InstallationDirectory

  • Silent

The following table lists all of the context parameters and their descriptions.

Setting

Description

WizardType

A constant indicating the type of wizard. There are three types:

  • vsWizardNewProject (GUID = "{0F90E1D0-4999-11D1-B6D1-00A0C90F2744}")

  • vsWizardAddItem (GUID = "{0F90E1D1-4999-11D1-B6D1-00A0C90F2744}")

  • vsWizardAddSubProject (GUID = "{0F90E1D2-4999-11D1-B6D1-00A0C90F2744}")

ProjectName

The name of the project.

ProjectItems

A pointer to the ProjectItems collection on which the wizard will operate. This is passed to the wizard based on the project hierarchy selection.

LocalDirectory

The location on the local system where the wizard's working project files are stored.

ItemName

The name of the item to be added. ItemName is the file name that the user types (or that is accepted by default) in the Add Item dialog box. Depending upon the flags set in the VSDIR file, this setting might be NULL.

InstallationDirectory

The directory path where Visual Studio is installed.

FExclusive

A Boolean value indicating whether the project should be exclusive unto itself. That is, either the project is added to the current solution, or the system closes the current solution, creates a new one, and then adds the project to it.

SolutionName

The name for the solution file without the directory portion or .sln extension. (The .suo file name is also based on this root name.) If SolutionName contains a value (that is, if it is not an empty string), the NewProject wizard calls Create before adding the project with AddFromTemplate. If SolutionName is an empty string, however, you do not need to call Createbefore calling AddFromTemplate.

Silent

A Boolean value indicating whether the wizard should run silently, without displaying a user interface (UI), taking all of the default values. The default value for Silent is True.

See Also

Reference

Execute

IDTWizard

Concepts

Adding Wizards to the Add Item and New Project Dialog Boxes by Using .Vsdir Files