This project has moved and is read-only. For the latest updates, please go here.

Export attribute not inherited

Feb 18, 2010 at 3:14 PM


Please could somebody tell me why the Export attribute can no longer be applied at an interface level and why it is not inherited any more. It use to be possible to achieve both of these things.  Obviously one without the other would be a little meaningless but I am unsure as to why if you implement an interface it cannot also mean you are implementing an export?

Kind Regards


Feb 18, 2010 at 4:49 PM

There was a lot of difficulty with having the ExportAttribute be inherited in all cases so we decided to not inherit it at all and have people explicitly opt in to inheritance by using a new attribute InheritedExportAttribute. So applying the InheritedExportAttribute on your interface will get you want you are looking for.

Feb 19, 2010 at 3:12 PM

InheritedExportAttribute didn't seem to be working for me. Not sure if it was something to do with the class structure I am using. A class that implements the Interface A which in turn extends Interface B which has the InheritedExportAttribute on it.

I found that using a custom export attribute as part of my custom metadata attribute actually a better fit for my model. Anyone implementing a plugin would need to decorate their class with the custom metadata attribute anyway.

Thanks for your help on this.


Feb 19, 2010 at 5:42 PM

Yes if you actually do need metadata as well then a custom export attribute is the best way to go. InheritedExport is really only useful for legacy type systems or systems where the author wants to hide all MEF details from the extenders.