Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Developing managed types for COM and consuming managed types from COM

Links

Developing managed types for COM and consuming managed types from COM

by  computerjin  Posted    (Edited  )

Writing a .NET type and consuming that type from unmanaged code are distinct activities for developers. Following links describe several tips for writing managed code that interoperates with COM clients:

To develope a managed type for COM
[link http://msdn2.microsoft.com/en-us/library/7fcfby2t(VS.80).aspx][color red]Qualifying .NET types for interoperation.[/color][/link]
All managed types, methods, properties, fields, and events that you want to expose to COM must be public. Types must have a public default constructor, which is the only constructor that can be invoked through COM.

[link http://msdn2.microsoft.com/en-us/library/d4w8x20h(VS.80).aspx][color red]Applying interop attributes.[/color][/link]
Custom attributes within managed code can enhance the interoperability of a component.

[link http://msdn2.microsoft.com/en-us/library/bctyca52(VS.80).aspx][color red]Packaging an assembly for COM.[/color][/link]
COM developers might require that you summarize the steps involved in referencing and deploying your assemblies.


Additionally, following links identify the tasks related to consuming a managed type from a COM client.

To consume a managed type from COM
[link http://msdn2.microsoft.com/en-us/library/h627s4zy(VS.80).aspx][color red]Register assemblies with COM.[/color][/link]
Types in an assembly (and type libraries) must be registered at design time. If an installer does not register the assembly, instruct COM developers to use Regasm.exe.

[link http://msdn2.microsoft.com/en-us/library/s5628ssw(VS.80).aspx][color red]Reference .NET types from COM.[/color][/link]
COM developers can reference types in an assembly using the same tools and techniques they use to refer other COM types.

[link http://msdn2.microsoft.com/en-us/library/8hw8h46b(VS.80).aspx][color red]Call a .NET object.[/color][/link]
COM developers can call methods on the .NET object the same way they call methods on any unmanaged type.

[link http://msdn2.microsoft.com/en-us/library/c2850st8(VS.80).aspx][color red]Deploy an application for COM access.[/color][/link]
A strong-named assembly can be installed in the global assembly cache and requires a signature from its publisher. Assemblies that are not strong named must be installed in the application directory of the client.


Hope it helps.

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top