无法添加对dll的引用(A reference to the dll could not be added)

编程入门 行业动态 更新时间:2024-10-15 02:32:15
无法添加对dll的引用(A reference to the dll could not be added)

当我在C#应用程序中添加一个.dll文件作为引用时,会显示一个错误:

无法添加对“.... dll”的引用。请确保该文件可访问,并且它是有效的程序集或COM组件。

ILDissassembler说没有有效的CLR标头,所以我尝试使用regsvr32注册它,这给我另一个错误:

模块“”被加载,但对DLLRegisterServer的调用失败,出现错误代码“0x80004005”

我在64位Windows 7机器上使用VS2010终极版本。 可能是什么问题呢?

感谢任何提示/回复

When I add a .dll file as a reference in C# application it shows an error :

A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component.

ILDissassembler says there is no valid CLR header so I try to register it using regsvr32 and that gives me another error:

The module "" was loaded but the call to DLLRegisterServer failed with error code '0x80004005'

I am using VS2010 ultimate version on a 64bit Windows 7 machine. What could be the problem?

Thanks for any hints/replies

最满意答案

以下为我工作:

简短的答案

通过命令行(cmd)运行以下命令:

TlbImp.exe cvextern.dll //where cvextern.dll is your dll you want to fix.

并为您创建一个有效的dll。

更长的答案

打开cmd

查找TlbImp.exe。 可能位于C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Bin。 如果你找不到它去你的根文件夹(C:\或D :)并运行:

dir tlbimp.exe /s //this will locate the file.

运行tlbimp.exe并把你的dll放在它后面。 示例:如果您的dll是cvextern.dll。 你可以运行:

TlbImp.exe cvextern.dll 在tlbimp.exe的同一个文件夹中创建了一个新的dll。 您可以将其用作项目中的参考。

I used dependency walker to check out the internal references the dll was having. Turns out it was in need of the VB runtime msvbvm60.dll and since my dev box doesnt have that installed I was unable to register it using regsvr32

That seems to be the answer to my original question for now.

更多推荐

本文发布于:2023-08-07 01:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1459432.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:dll   reference   added

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!