locked
How to change Embed Interop Types property. RRS feed

  • Question

  • I had a VS/VSTO 2010 project that contained no error or warnings.  Today I converted it to VS/VSTO 2013 project and I'm now getting the following warning.  Please what does this warning mean and how do I fix it?  Thanks.

    Warning 1 A reference was created to embedded interop assembly 'Microsoft.Office.Tools' because of an indirect reference to that assembly from assembly 'Microsoft.Office.Tools.Word'. Consider changing the 'Embed Interop Types' property on either assembly. Beginner Word Addin


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm

    Friday, November 28, 2014 6:48 PM

Answers

  • Hello Greg,

    Beginning with the .NET Framework 4, the common language runtime supports embedding type information for COM types directly into managed assemblies, instead of requiring the managed assemblies to obtain type information for COM types from interop assemblies. Because the embedded type information includes only the types and members that are actually used by a managed assembly, two managed assemblies might have very different views of the same COM type. Each managed assembly has a different Type object to represent its view of the COM type. 

    Try to set the 'Embed Interop Types' property of the mentioned references to true. Does it help?

    • Marked as answer by Greg Maxey Saturday, November 29, 2014 4:07 PM
    Saturday, November 29, 2014 3:54 PM

All replies

  • Hello Greg,

    Beginning with the .NET Framework 4, the common language runtime supports embedding type information for COM types directly into managed assemblies, instead of requiring the managed assemblies to obtain type information for COM types from interop assemblies. Because the embedded type information includes only the types and members that are actually used by a managed assembly, two managed assemblies might have very different views of the same COM type. Each managed assembly has a different Type object to represent its view of the COM type. 

    Try to set the 'Embed Interop Types' property of the mentioned references to true. Does it help?

    • Marked as answer by Greg Maxey Saturday, November 29, 2014 4:07 PM
    Saturday, November 29, 2014 3:54 PM
  • Eugene,

    I wish that I understood you explanations but I'm just not there yet :-(.  Yes, setting the Embed Interop Types property to both eliminated the warning.  Thank you.


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm

    Saturday, November 29, 2014 4:08 PM