Is there a way of开发者_StackOverflow getting MEF to load unmanaged code, such as com objects that are not written Java or are native Win32 code ?
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.
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.
精彩评论