码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:blog   http   strong   os   2014   cti   

错误:

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

标签:blog   http   strong   os   2014   cti   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!