
Wrapping Managed Objects in a Native Application
To create a COM callable wrapper using Visual Studio
Create a Class Library project for the managed class that you want to run in native code. The class must have a default constructor.
Verify that you have a complete four-part version number for your assembly in the AssemblyInfo file. This number is required for maintaining versioning in the Windows registry. For more information about version numbers, see Assembly Versioning.
On the Project menu, click Properties.
Click the Compile tab.
Select the Register for COM interop check box.
When you build the project, the assembly is automatically registered for COM interop. If you are building a native application in Visual Studio 2005, you can use the assembly by clicking Add Reference on the Project menu.
To create a COM callable wrapper using .NET Framework tools
This tool reads the assembly metadata and adds the necessary entries to the registry. As a result, COM clients can create .NET Framework classes transparently. You can use the assembly as if it were a native COM class.
You can run Regasm.exe on an assembly located in any directory, and then run the Global Assembly Cache Tool (Gacutil.exe) to move it to the global assembly cache. Moving the assembly does not invalidate location registry entries, because the global assembly cache is always examined if the assembly is not found elsewhere.