_DTE.LaunchWizard Method

Runs a wizard with the supplied parameters.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)


Function LaunchWizard ( _
    VSZFile As String, _
    ByRef ContextParams As Object() _
) As wizardResult
wizardResult LaunchWizard(
    string VSZFile,
    ref Object[] ContextParams
wizardResult LaunchWizard(
    [InAttribute] String^ VSZFile, 
    [InAttribute] array<Object^>^% ContextParams
abstract LaunchWizard : 
        VSZFile:string * 
        ContextParams:Object[] byref -> wizardResult 
function LaunchWizard(
    VSZFile : String, 
    ContextParams : Object[]
) : wizardResult


  • VSZFile
    Type: System.String
    Required. The .Vsz (wizard) file containing the information required to launch the wizard.
  • ContextParams
    Type: array<System.Object[]%
    Required. The parameters for the wizard. The first parameter is a GUID that uniquely identifies the launch context as distinct from Add Item or Add Project or a custom GUID. The remaining arguments are user-defined and their number and values depend on the wizard.
    Wizards (or templates) that come with Visual Studio — such as Visual Basic Windows Application or Visual C# Console Application—have a required set of context parameters that you must pass to them. For details on these, see ContextParams Enum. Wizards that you create can have more or less parameters.

Return Value

Type: EnvDTE.wizardResult
A wizardResult object.


The main UI thread of the IDE is synchronous with the wizard's execution, so users cannot do anything until the wizard completes.

The following macro example demonstrates how to use the LaunchWizard method to launch the Visual Studio Add Item wizard. This wizard uses seven custom parameters, so values are set for each one. Any exceptions are caught by the Try...Catch block.


Sub LaunchWizardExample()
   Dim params() As Object = New Object() { _
     "{0F90E1D0-4999-11D1-B6D1-00A0C90F2744}", _  ' Param 0
     "MyConsoleProject", _                        ' Param 1
     "C:\MyProjects", _                           ' Param 2
     "", _                                        ' Param 3
     False, _                                     ' Param 4
     "", _                                        ' Param 5
     False}                                       ' Param 6
   ' The wizardResult constant determines the state of the wizard, such 
   ' as did it complete or was it canceled, etc.
   Dim res As EnvDTE.wizardResult
   ' Set the project type to a Visual Basic project.
   Dim s As String = _

   ' Launch the Visual Basic Console Application wizard using the
   ' supplied parameters. Any exceptions are caught below.
      res = DTE.LaunchWizard(s & "ConsoleApplication.vsz", params)
   Catch e1 As System.Exception
      MsgBox("Error: " & e1.Message)
   End Try
End Sub

.NET Framework Security

See Also


_DTE Interface

EnvDTE Namespace