RegistrationHelper::InstallAssembly Method (String^, String^%, String^%, InstallationFlags)

 

Installs the named assembly in a COM+ application.

Namespace:   System.EnterpriseServices
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)

public:
virtual void InstallAssembly(
	String^ assembly,
	String^% application,
	String^% tlb,
	InstallationFlags installFlags
) sealed

Parameters

assembly
Type: System::String^

The file name of the assembly to install.

application
Type: System::String^%

The name of the COM+ application to install into. This parameter can be null. If the parameter is null and the assembly contains a ApplicationNameAttribute, then the attribute is used. Otherwise, the name of the application is generated based on the name of the assembly, then is returned.

tlb
Type: System::String^%

The name of the output Type Library Exporter (Tlbexp.exe) file, or a string that contains null if the registration helper is expected to generate the name. The actual name used is placed in the parameter on call completion.

installFlags
Type: System.EnterpriseServices::InstallationFlags

A bitwise combination of the InstallationFlags values.

Exception Condition
RegistrationException

The input assembly does not have a strong name.

InstallAssembly performs the following steps: registration, generation of a type library, registration of the type library, installation of the type library under the specified application, and configuration of the components contained in the type library.

This method requires the caller to have administrative privileges on the local computer.

The following code example shows how to use the InstalAssembly method to install a named assembly in a COM+ application.

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();

SecurityPermission

for the ability to access unmanaged code. Associated enumeration: SecurityPermissionFlag::UnmanagedCode

RegistryPermission

for the ability to access the registry. Associated enumeration: PermissionState::Unrestricted

.NET Framework
Available since 1.1
Return to top
Show: