When a VSIX project that contains MEF components is installed, how does visual studio find the MEF components? I know the regular way could be adding catalogs of dll directories that contains the MEF parts. How does Visual Studio know where to look to find the MEF in VSIX project?
Visual Studio Extensions (VSIX) usually contain a VS Package class, an extension.vsixmanifest file, and zero or more PKGDEF files that provided metadata and extension initialization information to the IDE.
VS is made aware of MEF components via a MefComponent registration in the extension.vsixmanifest file that indicates that a specific assembly should be scanned at MEF cache generation.
The simplest way to declare a MEF component in your extension is to right click on the project, select 'New Item', and add a Package to your project. This will provide the source.extension.vsixmanifest file to which you can add the MEF component registration. Double click this file, and add your registration in the 'Assets' tab of the VSIX manifest designer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With