c# - 无法在我的 Visual Studio 项目中使用我的互操作 DLL

标签 c# com com-interop

我正在使用第 3 方 dll。 Interop.CRYPTLib。我尝试在我的 .net 应用程序中使用它,但收到此错误

"Retrieving the COM class factory for component with CLSID {AF6AF735-6D30-4E16-8AFA-FD4317E87D1B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

我尝试使用 regsvr32 但现在收到此错误

The module was loaded but the entry-point dllregisterserver was not found

我使用了 regasm,它表示类型已成功注册,但它仍然因第一个错误而失败,但是当我使用/tlb:Interop.cryptlib.tlb 时,我收到错误

Interop.CRYPTLib.dll' was imported from a type library and cannot be re-exported to a type library.  Make sure the type library from
which the assembly was imported is registered.

我的代码是

var s = new CRYPTLib.EncryptDecryptClass();

最佳答案

Interop.CRYPTLib 不是 COM DLL - 它只是 CRYPTLib COM DLL 的 .NET 包装器。您需要实现 CRYPTLib 的 DLL(可能是 CRYPTLib.dll)并使用 regsvr32 安装该 DLL。

关于c# - 无法在我的 Visual Studio 项目中使用我的互操作 DLL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16943219/

相关文章:

c# - C# 中的非托管句柄,我需要释放还是销毁?

c# - 绑定(bind)到引用,而不是对象

c# - 在触发错误中设置TextDecoration

c# - 快速找到最近浮点值的数据结构

c# - C#中的虚拟继承

.net - Dll 在一个单独的进程中?

delphi - 如何将IDL导入到Delphi中?

python - COM: excelApplication.Application.Quit() 保留进程

c# - 从 C++ Win32 调试托管组件

c# - 将 Excel 文件导出为 PDF - 在尝试关闭 Excel 文件时卡住