views:

54

answers:

2

Is there a way of getting MEF to load unmanaged code, such as com objects that are not written Java or are native Win32 code ?

+1  A: 

You could either wrap the class and then export the wrapper or you may be able to create a custom export provider that exposed these types through interop or maybe even methods through pinvoke.

Adam Driscoll
A: 

You could add an export attribute to COM types by either deriving your own type from the interop type (which is probably the simpler solution), or by generating the interop assembly (using tlbimp), and then modifying it to add an export attribute to the class. Modifying the assembly would involve disassembling it (ildasm), adding a reference to MEF and the Export attribute to the appropriate type, and then re-assembling it.

Daniel Plaisted