Share via


COM Interoperability for Devices

The .NET Compact Framework supports Runtime Callable Wrappers (also called "Interop Assemblies") for COM objects. This feature includes the marshaling of complex types. COM Interop for devices is based on the desktop implementation. Therefore, components must be registered on the desktop.

Supported Scenarios

The following scenarios are supported for device projects in Visual Studio:

  • You can add an existing COM component as a reference to a managed project. This action creates an interop assembly and automatically adds the assembly as a reference. You can then use the interop assembly just as you could any managed assembly, and the properties, methods, and events of the object are available for IntelliSense and in the Object Browser. Legal file types to add are DLL, EXE, and TLB.

  • You can create a native project to generate a COM component, and then create a managed project in the same solution to consume the COM component. The process is the same as for the desktop:

    • Set the native project to generate TLB output.

    • Compile the native project to generate a DLL.

    • In the managed project, add a reference to the DLL. This action generates the interop assembly.

Unsupported Scenarios

The following scenarios are not supported in Visual Studio:

  • Referencing an existing ActiveX COM component from a managed project

  • COM objects that have non-system child components

  • COM objects referenced as business objects from the DataSource Wizard.

See Also

Tasks

Walkthrough: Hello World: A COM Interop Example for Smart Devices

Walkthrough: Debugging a Solution that Includes Both Managed and Native Code

Concepts

Introduction to COM Interop

Runtime Callable Wrapper

Marshaling Selected Interfaces

Other Resources

COM Interoperability in .NET Framework Applications

Programming for Devices Using the .NET Compact Framework

Interoperability in the .NET Compact Framework