VSTO2010: Reference to class 'RibbonBase' is not allowed when its assembly is linked using No-PIA mode
When I try to compile my VSTO Outlook addin, I get this error:
Reference to class 'RibbonBase' is not allowed when its assemb开发者_开发技巧ly is linked using No-PIA mode
Can't seam to find a solution to it online.
Any idea?
Thanks! Mojo
Certain COM libraries, including this one, do not support No-PIA mode.
Change Embed Interop Type
to false in the properties of the reference.
I can't swear that what I'm about to offer would fix the RibbonBase issue, but I received exactly the same error message with respect to a class I was trying to use in Access, and found myself reading this question & answer, so I'd like to offer my solution as I suspect strongly that it might also fix the RibbonBase problem.
The issue is one of referencing a CLASS rather than an Interface. If you search for "is not allowed when its assembly is linked using No-PIA mode" in http://msdn.microsoft.com/en-us/library/h8c469ey.aspx, you can see where I get this from.
It kind-of makes sense - I can see that making the interfaces available gives a better object design (by separating interface from implementation) and would also reduce the meta-data required.
In Access, I was trying to reference ControlClass, and when I switched to using just "Control" (it's interface) then all worked fine for me.
From what I've read, I believe that SLaks solution, while it will undoubtedly work, it will require the Interop assemblies to be instelled on the machine that the solution is deployed on, where as switching to an interface (if possible) then allows you to deploy without the Interop assemblies. For me, that makes my suggestion more attractive, if it could be applied in the case of "RibbonBase".
精彩评论