NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Registering a NGWS Class with COM

Any instance of a public class that can be created and consumed within the NGWS execution environment can also be created and consumed by unmanaged COM clients, provided that you register them. A NGWS class that does not have a public constructor cannot be instantiated by managed clients, so it cannot be instantiated by unmanaged COM clients, either.

To register or unregister a NGWS class with COM, you must run a command-line utility called RegAsm. The RegAsm utility adds information about the class to the system registry so COM clients can use the NGWS class transparently.

Under the HKCR/CLSID registry key, RegAsm creates a new entry for the CLSID of the NGWS class. If you run RegAsm on the same class more than once, the class will always have the same CLSID in COM.

Under the HKCR\CLSID\{…} key, the default value is set to the ProgID of the class, and two new named values are added. The class value is a string that contains the fully qualified name of the NGWS class that provides the implementation. If a class with the specified name is not already loaded, the runtime reads the assembly value from the registry and passes it on to the runtime's assembly resolver. The assembly resolver attempts to locate the assembly based on the assembly name. Before the assembly resolver can locate the assembly, the assembly must be signed and installed in the runtime's assembly cache or it must be found along the application path. Assemblies loaded from the application path are only accessible from that application. Shared assemblies must be signed and installed in the assembly cache.

The RegAsm utility also creates the InProcServer32 key under the HKCR\CLSID\{0000…0000} key. The default value for the key is set to the name of the DLL that contains the NGWS runtime. Clients can call DllGetClassObject on the runtime DLL to get a class factory and create objects, just as they would with any other COM component.

See Also

COM Registration Utility (RegAsm.exe)