DTE2.LaunchWizard Method

Runs a wizard with the supplied parameters.

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

Syntax

'Declaration
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

Parameters

  • 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 fewer parameters.

Return Value

Type: EnvDTE.wizardResult
A wizardResult object.

Implements

_DTE.LaunchWizard(String, array<Object[]%)

Remarks

The main user interface (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.

Examples

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 whether it completed, was canceled, and so on.
   Dim res As EnvDTE.wizardResult
   ' Set the project type to a Visual Basic project.
   Dim str As String = _
     DTE.Solution.TemplatePath(VSLangProj.PrjKind.prjKindVBProject)

   ' Start the Visual Basic Console Application wizard by using the
   ' supplied parameters. Exceptions are caught below.
   Try
      res = DTE2.LaunchWizard(str & "ConsoleApplication.vsz", params)
   Catch e1 As System.Exception
      MsgBox("Error: " & e1.Message)
   End Try
End Sub

.NET Framework Security

See Also

Reference

DTE2 Interface

EnvDTE80 Namespace