C# - 设置DLL的属性Embed Interop Type 设为False
错误:
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中已经将其封装了,对开发者而言是透明的。 参考

官方解释:
http://msdn.microsoft.com/en-us/library/ff182188.aspx
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.
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://bbs.csdn.net/topics/390599484
C# - 设置DLL的属性Embed Interop Type 设为False的更多相关文章
- C#操作Office- Cannot find the interop type that matches the embedded interop type 'Microsoft.Office.Interop.Excel.Application'
网上说 2003 -> 11.0, 2007 -> 12.0. 因为平时提示"Are you missing an assembly reference?",都是没有引 ...
- 给li设置float浮动属性之后,无法撑开外层ul的问题。
最近在项目中有好几次遇到这个问题,感觉是浮动引起的,虽然用<div style="clear:both"></div>解决了,但自己不是特别明白,又在网上查 ...
- DLL放在指定目录 以及设置dll调用路径
一.DLL放在指定目录 在编写C# winform程序中,不免一个项目会有多个工程文件,而这些工程文件之间是相互引用的,所以不想将工程的生成结果(exe或者dll)放在当前工程bin目录下的Debug ...
- 给li设置float浮动属性之后,无法撑开外层ul的问题。(原址:http://www.cnblogs.com/cielzhao/p/5781462.html)
最近在项目中有好几次遇到这个问题,感觉是浮动引起的,虽然用<div style="clear:both"></div>解决了,但自己不是特别明白,又在网上查 ...
- JQUERY操作html--获取和设置内容、属性、回调函数
一:jQuery - 获取内容和属性 1.获得内容 - text().html() 以及 val() text() - 返回所选元素的文本内容 html() - 返回所选元素的内容(包括 HTML 标 ...
- C#反射技术的简单操作(读取和设置类的属性)
public class A { public int Property1 { get; set; } } static void Main(){ A aa = new A(); Type type ...
- JavaScript(19)jQuery HTML 获取和设置内容和属性
jQuery HTML jQuery 拥有可操作 HTML 元素和属性的强慷慨法. jQuery DOM 操作 jQuery 中非常重要的部分,就是操作 DOM 的能力.jQuery 提供一系列与 D ...
- RMAN增量备份-备份保留策略-设置备份集属性
RMAN增量备份:增量备份级别:0,1,2,3,4BACKUP DATABASE也是创建数据库的完整备份,但是这种备份不同于增量备份的0级备份.这种备份不包含增量备份的0级备份,并不支持在此基础上再创 ...
- 使用storyboard设置button边框属性(颜色,宽度,圆角)
通常使用Category时.仅仅能加入方法,不可加入属性.可是在使用Storyboard时我们可能会使用到keyPath,这里设置的key都须要是所设置视图的属性值.而且类型有所限制. 比如:我如今有 ...
随机推荐
- Part 57 to 58 Why should you override ToString and Equal Method
Part 57 Why should you override ToString Method sometimes you can override ToString method like that ...
- Jquery 计算表格某一列的合计
<script type="text/javascript"> function heji(table_id, lie, val_id) { //合计 --xpp // ...
- lua技巧分享之保护执行
我们在c#/c++里为了防止调用出现异常的时候程序可以正常的执行,经常使用try{}catch{}的结构, 那么,语言简单的lua是怎么做到的呢?答案就在pcall 先简单的介绍一下这个函数: --尝 ...
- php中simplexml_load_string使用实例
先用一段代码重现一下问题 乍一看,结果很让人费解: 代码如下 复制代码 <?php $string = <<<EOF <data> <foo><b ...
- Coarse-Grained lock 粗粒度锁
用一个锁Lock一组相关的对象 有时,需要按组来修改多个对象. 这样,在需要锁住其中一个的时候,必须连带地将其他的对象都上锁. 为每一个对象都加上一个锁是很繁琐的. 粗粒度锁是覆盖多个对象的单个锁. ...
- 20140122-Application19事件
- 构造高度自适应的textarea
高度自适应的textarea,这个需求还是比较常见的,随着用户的输入textarea的高度自动变化,这样输入较少的时候可以节省空间,输入多的时候可以不出现滚动条,让内容尽可能的展现在用户的视线内. 可 ...
- JS学习第四课
当我们删除某列表格,再添加新的一列时,它的序号该如何控制呢.这里id=oTab.tBodies[0].rows.length+1 otd.innerHTML=id++; 很关键哦. ...
- Microsoft Office Access 不能在追加查询中追加所有记录
有客户反映,我们的软件ACCESS数据库版本在使用时会出现"Microsoft Office Access 不能在追加查询中追加所有记录"的错误.使用客户的数据库调试软件发现错误出 ...
- JS判断客户端是手机还是PC
function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", " ...
Note