Partager via


Manually Registering an Assembly

The .NET Framework SDK provides the .NET Framework Services Installation Tool (Regsvcs.exe) to manually register an assembly containing serviced components. Regsvcs.exe is a command-line tool. You can also access these registration features programmatically with the System.EnterpriseServices.RegistrationHelper class by creating an instance of the RegistrationHelper class and using the InstallAssembly method.

Although not always required, it is helpful to manually register assemblies for design-time testing. Unlike dynamic registration, the manual process provides feedback about errors encountered during execution.

**Note   **If you create a server application, the assembly and any assemblies on which it depends must be added to the global assembly cache (GAC) by using Windows Installer before the server application can be used; otherwise, the application generates an exception.

The following table lists each step performed by the Regsvcs.exe (or the API) and describes the failures that are possible at each step.

Step Possible failure Result
Loads the assembly. The assembly fails to load. Displays an error message and failure description.
Registers the assembly. The type registration fails. Improperly specified assemblies result in a TypeLoadException exception.
Generates a type library. The library generation fails. Improperly specified assemblies result in a TypeLoadException exception.
Calls the LoadTypeLibrary method to register the type library. The Automation call fails. Generates a TypeLoadException exception.
Installs the type library into the requested application. The Assembly Registration tool (Regasm.exe) cannot find the specified application. Displays the error message "One of the objects could not be found."

To resolve, confirm the location of the specified type library and application.

Configures the class. The tool detects a service attribute mismatch during registration — for example, if you have a class configured with conflicting properties such as the following:

TransactionOption.Required

SynchonizationOption.Disabled

Displays an error describing the conflict or modifies one of the mismatched services.

See Also

Registering Serviced Components | Dynamically Registering an Assembly | .NET Framework Services Installation Tool (Regsvcs.exe) | System.EnterpriseServicesRegistrationHelper | System.EnterpriseServices Namespace