Share via


RegistrationHelper.InstallAssembly 方法

定義

提供 COM+ 目錄可使用的執行階段元件。

多載

InstallAssembly(String, String, String, InstallationFlags)

安裝 COM+ 應用程式中的命名組件。

InstallAssembly(String, String, String, String, InstallationFlags)

安裝 COM+ 應用程式中的命名組件。

InstallAssembly(String, String, String, InstallationFlags)

安裝 COM+ 應用程式中的命名組件。

public:
 virtual void InstallAssembly(System::String ^ assembly, System::String ^ % application, System::String ^ % tlb, System::EnterpriseServices::InstallationFlags installFlags);
public void InstallAssembly (string assembly, ref string application, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags);
abstract member InstallAssembly : string * string * string * System.EnterpriseServices.InstallationFlags -> unit
override this.InstallAssembly : string * string * string * System.EnterpriseServices.InstallationFlags -> unit
Public Sub InstallAssembly (assembly As String, ByRef application As String, ByRef tlb As String, installFlags As InstallationFlags)

參數

assembly
String

要安裝的組件檔案名稱。

application
String

要安裝入的 COM+ 應用程式的名稱。 這個參數可以是 null。 如果參數為 null 且組件包含 ApplicationNameAttribute,則會使用屬性。 否則,應用程式的名稱會根據組件的名稱來產生,然後傳回。

tlb
String

輸出的型別程式庫匯出工具 (Tlbexp.exe) 檔案名稱,或含有 null 的字串 (如果註冊 Helper 必須產生名稱的話)。 使用的實際名稱在呼叫完成時將置於參數中。

installFlags
InstallationFlags

InstallationFlags 值的位元組合。

實作

例外狀況

輸入組件沒有強式名稱。

範例

下列程式代碼範例示範如何使用 InstalAssembly 方法在 COM+ 應用程式中安裝具名元件。

String^ applicationName = "Queued Component";
String^ typeLibraryName = nullptr;
RegistrationHelper^ helper = gcnew RegistrationHelper;
// Call the InstallAssembly method passing it the name of the assembly to 
// install as a COM+ application, the COM+ application name, and 
// the name of the type library file.
// Setting the application name and the type library to NULL (nothing in Visual Basic .NET
// allows you to use the COM+ application name that is given in the assembly and 
// the default type library name. The application name in the assembly metadata 
// takes precedence over the application name you provide to InstallAssembly. 
helper->InstallAssembly( "C:..\\..\\QueuedComponent.dll",  applicationName,  typeLibraryName, InstallationFlags::CreateTargetApplication );
Console::WriteLine( "Registration succeeded: Type library {0} created.", typeLibraryName );
Console::Read();
string applicationName = "Queued Component";			
string typeLibraryName = null;
RegistrationHelper helper = new RegistrationHelper();
// Call the InstallAssembly method passing it the name of the assembly to
// install as a COM+ application, the COM+ application name, and
// the name of the type library file.
// Setting the application name and the type library to NULL (nothing in Visual Basic .NET
// allows you to use the COM+ application name that is given in the assembly and
// the default type library name. The application name in the assembly metadata
// takes precedence over the application name you provide to InstallAssembly.
helper.InstallAssembly(@"C:..\..\QueuedComponent.dll", ref applicationName, ref typeLibraryName, InstallationFlags.CreateTargetApplication);
Console.WriteLine("Registration succeeded: Type library {0} created.", typeLibraryName);
Console.Read();
Dim applicationName As String = "Queued Component"
Dim typeLibraryName As String = Nothing
Dim helper As New RegistrationHelper

' Call the InstallAssembly method passing it the name of the assembly to 
' install as a COM+ application, the COM+ application name, and 
' the name of the type library file.
' Setting the application name and the type library to NULL (nothing in Visual Basic .NET
' allows you to use the COM+ application name that is given in the assembly and 
' the default type library name. The application name in the assembly metadata 
' takes precedence over the application name you provide to InstallAssembly. 
helper.InstallAssembly("C:..\..\QueuedComponent.dll", applicationName, typeLibraryName, InstallationFlags.CreateTargetApplication)
MsgBox("Registration succeeded: Type library " & typeLibraryName & " created.")
Console.Read()

備註

InstallAssembly 會執行下列步驟:註冊、產生類型庫、註冊類型庫、在指定的應用程式下安裝類型庫,以及類型連結庫中所包含的元件元件組態。

此方法需要呼叫端在本機計算機上具有系統管理許可權。

適用於

InstallAssembly(String, String, String, String, InstallationFlags)

安裝 COM+ 應用程式中的命名組件。

public:
 void InstallAssembly(System::String ^ assembly, System::String ^ % application, System::String ^ partition, System::String ^ % tlb, System::EnterpriseServices::InstallationFlags installFlags);
public void InstallAssembly (string assembly, ref string application, string partition, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags);
member this.InstallAssembly : string * string * string * string * System.EnterpriseServices.InstallationFlags -> unit
Public Sub InstallAssembly (assembly As String, ByRef application As String, partition As String, ByRef tlb As String, installFlags As InstallationFlags)

參數

assembly
String

要安裝的組件檔案名稱。

application
String

要安裝入的 COM+ 應用程式的名稱。 這個參數可以是 null。 如果參數為 null 且組件包含 ApplicationNameAttribute,則會使用屬性。 否則,應用程式的名稱會根據組件的名稱來產生,然後傳回。

partition
String

資料分割的名稱。 這個參數可以是 null

tlb
String

輸出的型別程式庫匯出工具 (Tlbexp.exe) 檔案名稱,或含有 null 的字串 (如果註冊 Helper 必須產生名稱的話)。 使用的實際名稱在呼叫完成時將置於參數中。

installFlags
InstallationFlags

InstallationFlags 值的位元組合。

例外狀況

輸入組件沒有強式名稱。

備註

InstallAssembly 會執行下列步驟:註冊、產生類型庫、註冊類型庫、在指定的應用程式下安裝類型庫,以及類型連結庫中所包含的元件元件組態。

此方法需要呼叫端在本機計算機上具有系統管理許可權。

適用於