DTE2.LaunchWizard 方法 (String, array<Object %)

以提供的參數執行精靈。

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.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
    型別:System.String
    必要項。.Vsz (精靈) 檔中有啟動精靈時所需的資訊。
  • ContextParams
    型別:array<System.Object[]%
    必要項。精靈的參數。第一個參數是 GUID,它能唯一地識別出啟動內容,這有別於 Add Item 或 Add Project 或自訂 GUID。其餘的引數為使用者所定義,而且其數目和值是取決於精靈。
    隨附於 Visual Studio 的精靈 (或樣板) (例如 Visual Basic [Windows 應用程式] 或 Visual C# [主控台應用程式]) 具有您必須傳遞給它們的必要內容參數集。如需關於這些的詳細資訊,請參閱 ContextParams Enum。您所建立的精靈可以包含更多或更少的參數。

傳回值

型別:EnvDTE.wizardResult
wizardResult 物件。

備註

IDE 的主要使用者介面 (UI) 執行緒與精靈的執行同步,因此使用者必須等到精靈完成後才能執行動作。

下列巨集範例示範如何使用 LaunchWizard 方法啟動 Visual Studio [加入項目] 精靈。這個精靈會使用七個自訂參數,所以每個參數都會分別設定值。所有例外狀況都由 Try...Catch 區塊攔截。

範例

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 安全性

請參閱

參考

DTE2 介面

LaunchWizard 多載

EnvDTE80 命名空間