Partager via


Context Parameters

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

In the Visual Studio integrated development environment (IDE), you can add wizards to the New Project, Add New Item, or Add Sub Project dialog boxes. The added wizards are available on the File menu or by right-clicking a project in Solution Explorer. The IDE passes context parameters to the implementation of the wizard. The context parameters define the state of the project when the IDE calls the wizard.

The IDE starts wizards by setting the VSADDITEMOPERATION flag in the IDE's call to the AddItem method for the project. When set, the project must cause the IVsExtensibility::RunWizardFile method to be executed by using the registered wizard name or GUID and other context parameters that the IDE passes to it.

Context Parameters for New Project

Parameter Description
WizardType Registered wizard type (vsWizardNewProject) or the GUID that indicates the type of wizard. In the Visual Studio SDK implementation, the GUID for the wizard is {0F90E1D0-4999-11D1-B6D1-00A0C90F2744}.
ProjectName A string that is the unique Visual Studio project name.
LocalDirectory Local location of working project files.
InstallationDirectory Directory path of the Visual Studio is installation.
FExclusive Boolean flag which indicates that the project should close open solutions.
SolutionName Name of the solution file without the directory portion or the .sln extension. The .suo file name is also created by using SolutionName. When this argument is not an empty string, the wizard uses Create before adding the project with AddFromTemplate. If this name is an empty string, use AddFromTemplate without calling Create.
Silent Boolean that indicates whether the wizard should run silently as if Finish were clicked (TRUE).

Context Parameters for Add New Item

Parameter Description
WizardType Registered wizard type (vsWizardAddItem) or the GUID that indicates the type of wizard. In the Visual Studio SDK implementation, the GUID for the wizard is {0F90E1D1-4999-11D1-B6D1-00A0C90F2744}.
ProjectName A string that is the unique Visual Studio project name.
ProjectItems Local location that contains working project files.
ItemName Name of the item that is to be added. This name is either the default file name or the file name that the user types from the Add Items dialog box. The name is based on the flags that are set in the .vsdir file. The name can be a null value.
InstallationDirectory Directory path of the Visual Studio is installation.
Silent Boolean that indicates whether the wizard should run silently as if Finish were clicked (TRUE).

Context Parameters for Add Sub Project

Parameter Description
WizardType Registered wizard type (vsWizardAddSubProject) or the GUID that indicates the type of wizard. In the Visual Studio SDK implementation, the GUID for the wizard is {0F90E1D2-4999-11D1-B6D1-00A0C90F2744}.
ProjectName A string that is the unique Visual Studio project name.
ProjectItems Pointer to the ProjectItems collection on which the wizard operates. This pointer is passed to the wizard based on the project hierarchy selection. A user typically selects a folder in which to put the item and then calls the project's Add Item dialog box.
LocalDirectory Local location of working project files.
ItemName Name of the item that is to be added. This name is either the default file name or the file name that the user types from the Add Items dialog box. The name is based on the flags that are set in the .vsdir file. The name can be a null value.
InstallationDirectory Directory path of the Visual Studio is installation.
Silent Boolean that indicates whether the wizard should run silently as if Finish were clicked (TRUE).

See Also

IVsProject
IVsProject2
Custom Parameters
Wizards
Wizard (.Vsz) File
Context Parameters for Launching Wizards