This documentation is archived and is not being maintained.

LaunchWizard Method (DTE Object)

Visual Studio .NET 2003

Runs a wizard with the supplied parameters.

[Visual Basic .NET]
Public Function LaunchWizard( _
   ByVal VSZFile As String, _
   ByVal ContextParams() As Object _
) As wizardResult
[Visual Basic 6]
Function LaunchWizard( _
   ByVal VSZFile As String, _
   ByVal ContextParams() As Variant _
) As wizardResult
HRESULT __stdcall LaunchWizard(
   BSTR VSZFile,
   SAFEARRAY** ContextParams,
   /* [out, retval] */ wizardResult* retVal
public wizardResult LaunchWizard(
   string VSZFile,
   object[] ContextParams
[JScript .NET]
public function LaunchWizard(
   VSZFile : String,
   ContextParams : Object[]
) : wizardResult


Required. The .Vsz (wizard) file containing the information required to launch the wizard.
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 upon the wizard.

Wizards (or templates) that come with Visual Studio .NET — such as Visual Basic Windows Application or Visual C# .NET 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.


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 .NET 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 .NET project.
   Dim s As String = _

   ' Launch the Visual Basic .NET 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

See Also

Applies To: DTE Object