首页 > 其他 > 详细

C# - 设置DLL的属性Embed Interop Type 设为False

时间:2014-07-05 21:05:21      阅读:729      评论:0      收藏:0      [点我收藏+]

错误:

Error msg: A reference was created to embedded interop assembly. because of an indirect reference to that assembly created by assembly. Consider changing the ‘Embed Interop Types‘ property on either assembly.

 

解决方法:

      将DLL的属性Embed Interop Type 设为False.  否则会引起互操作类型异常。

  当设置为True时,该COM组件的交互类型信息将在编译时被嵌入到项目的类库中。

  当设置为False时,该COM组件的交互类型都需要一个额外的Primary Interop Assemblies(PIA)来提供。但是Net中已经将其封装了,对开发者而言是透明的。 参考

bubuko.com,布布扣

 

官方解释:

http://msdn.microsoft.com/en-us/library/ff182188.aspx

A reference was created to embedded interop assembly ‘<assembly1>‘ because of an indirect reference to that assembly from assembly ‘<assembly2>‘. Consider changing the ‘Embed Interop Types‘ property on either assembly.

 

You have added a reference to an assembly (assembly1) that has the Embed Interop Types property set to True. This instructs the compiler to embed interop type information from that assembly. However, the compiler cannot embed interop type information from that assembly because another assembly that you have referenced (assembly2) also references that assembly (assembly1) and has the Embed Interop Types property set to False.

bubuko.com,布布扣                   Note                

Setting the Embed Interop Types property on an assembly reference to True is equivalent to referencing the assembly by using the /link option for the command-line compiler.

Error ID: BC40059

To address this warning

  • To embed interop type information for both assemblies, set the Embed Interop Types property on all references to assembly1 to True.

  • To remove the warning, you can set the Embed Interop Types property of assembly1 to False. In this case, interop type information is provided by a primary interop assembly (PIA).

 

其他参考:

http://stackoverflow.com/questions/8156488/what-does-reference-was-created-to-embedded-interop-assembly-mean

http://blogs.clariusconsulting.net/kzu/check-your-embed-interop-types-flag-when-doing-visual-studio-extensibility-work/

http://bbs.csdn.net/topics/390599484

http://blogs.clariusconsulting.net/kzu/check-your-embed-interop-types-flag-when-doing-visual-studio-extensibility-work/

 

 

 

C# - 设置DLL的属性Embed Interop Type 设为False,布布扣,bubuko.com

C# - 设置DLL的属性Embed Interop Type 设为False

原文:http://www.cnblogs.com/viviancc/p/3826289.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!