0

I know from this post:

Can't Silence Embed Interop Warnings

that ActiveX objects cannot officially have their types embedded in a .NET assembly, and I think I am running into this as an error with OLE Interop mentioned in the title.

Strangely, I am able to occasionally compile the VB.NET project with embedded types from this library: "Microsoft.VisualStudio.OLE.Interop.dll" in VS2010 by toggling "Embed Interop Types" on and then off in the Solution explorer for it. This will squash the error sometimes and allow me to compile, and the resulting library works just fine. When reloading the project again, the error will reappear though. I can repeat the toggle to squash the error again.

I am wondering: is there a feature to consistently suppress this "Cannot embed interop types from assembly..." error in VS2010 for ActiveX components or am I running into a bug in VS2010? It would be a boon for deployment to be able to distribute one file instead of two.

Community
  • 1
  • 1
Beastian
  • 35
  • 1
  • 6
  • Probably a bug. VS2010 was training-wheels for a lot of new features, including this one. Its IntelliSense parser has flaws, it sounds like it is that one that generates the error. You consistently suppress the error by setting the Embed Interop Types property to False :) – Hans Passant Apr 05 '14 at 00:17
  • Thanks Hans. Would you be able to give any rationale as to why Microsoft decided that ActiveX components shouldn't be embedded? – Beastian Apr 05 '14 at 17:54
  • The wrapper is a class, derived from AxHost. It isn't just declarations anymore. – Hans Passant Apr 05 '14 at 20:42

0 Answers0