当我在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.
更多推荐
发布评论