I am using a COM DLL, a function call which returns an ADO RecordSet object and want to refer to it in my C# application.
我正在使用COM DLL,一个函数调用,它返回一个ADO RecordSet对象,并希望在我的C#应用程序中引用它。
Have added the reference, put the msado15,interop.adodb dll in the bin directory and debug directory, added assembly key in web.config
but still get the following error:
添加了引用,将msado15,interop.adodb dll放在bin目录和debug目录中,在web.config中添加了汇编键但仍然出现以下错误:
The type 'ADODB.Recordset' is defined in an assembly that is not referenced. You must add a reference to assembly 'ADODB, Version=7.0.3300.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a'.
“ADODB.Recordset”类型在未引用的程序集中定义。您必须添加对程序集“ADODB,Version = 7.0.3300.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”的引用。
Any ideas on what is the right way to do this?
关于什么是正确的方法的任何想法?
Edit:Which assembly do I add to GAC? Where can i find the ADODB.dll?
编辑:我将哪个程序集添加到GAC?我在哪里可以找到ADODB.dll?
Added the reference to c:\program files\microsoft.net\primary interop assemlies\adodb.dll and got it working finally
添加了对c:\ program files \ microsoft.net \ primary interop assemlies \ adodb.dll的引用并最终使其工作
2 个解决方案
#1
Try changing your reference to ADODB.dll in your project to 'Copy Local' true.
尝试将项目中对ADODB.dll的引用更改为“Copy Local”true。
#2
The assembly should be in GAC as the name suggests (the name has publickeytoken in it).
如名称所示,程序集应该在GAC中(名称中包含publickeytoken)。
EDIT: The interop assembly for which the error is raised should be in GAC. OR remove the reference from your project and add the reference to the dll from the bin dir.
编辑:引发错误的互操作程序集应该在GAC中。或者从项目中删除引用,并从bin目录添加对dll的引用。
#1
Try changing your reference to ADODB.dll in your project to 'Copy Local' true.
尝试将项目中对ADODB.dll的引用更改为“Copy Local”true。
#2
The assembly should be in GAC as the name suggests (the name has publickeytoken in it).
如名称所示,程序集应该在GAC中(名称中包含publickeytoken)。
EDIT: The interop assembly for which the error is raised should be in GAC. OR remove the reference from your project and add the reference to the dll from the bin dir.
编辑:引发错误的互操作程序集应该在GAC中。或者从项目中删除引用,并从bin目录添加对dll的引用。