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.
![]() |
---|
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都须要是所设置视图的属性值.而且类型有所限制. 比如:我如今有 ...
随机推荐
- Intent进行组件通信的一些体会
Intent进行组件通信的原理 l Intent协助应用间的交互与通讯 Intent负责对应用中一次操作的动作.动作涉及数据.附加数据进行描述.Android则根据此Intent的描述,负责找到对应 ...
- Python Opearte MS-SQL Use Pymssql
看到很多的开源数据库会用到MySQL,Python同样也使用,但是我已经习惯使用图形化界面,操作感极强的MS-SQL 看到Python也提供MS-SQL连接方式,需要用到PyMssql. 在Windo ...
- WPF非UI线程获取修改控件属性值的方法
public class InvokeHelper { #region delegates private delegate object MethodInvoker(Control control, ...
- asp.net ajax 调用错误解决
ajax调用aspx页面出现如下错误 前台源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
- Elementary os的安装
1. 使用安装文件进行数据读取 2. 进入安装界面 3. 选择语言并进行安装(可以先试用) 4. 选择继续(可以勾选两个选项,意思是 ...
- button等按钮onclientclick事件失效
如果确定JS没写错 第一种方法: 在JS方法最后return false; 调用方法前加上return 第二种方法: 在JS方法最后event.returnValue=false; 附加:event. ...
- UI1_ScrollViewHomeWork
// // AppDelegate.m // UI1_ScrollViewHomeWork // // Created by zhangxueming on 15/7/13. // Copyright ...
- Base Pattern基本模式_Gateway入口
•Gateway入口 ◦一个封装了对外部系统或资源访问的对象. ◾OO系统中,也需要访问一些不是对象的事物,DB表,XML,事务. ◾这些外部资源的API很复杂. ◾入口类对象将简单的方法调用转换成相 ...
- HTML文件中使用Java程序
HTML文件中使用Java程序:简而言之,在HTML文件中引入java应用程序,并通过javascript调用其方法. 一. 运行环境 1.JAVA_HOME.CLASSPATH.PATH配置正确 ...
- Cstring使用说明
CString::Left(intnCount)const; //从左边1开始获取前 nCount个字符 CString::Mid(intnFirst)const; //从左边第 nCount+1个字 ...