我有来自外部供应商的dll;它包含2个类:
namespace RDTiffDataAccess
{
public class RDTiffDataClass : IRDTiffData, RDTiffData
{
public RDTiffDataClass();
}
}
和
namespace RDTiffDataAccess
{
public interface IRDTiffData
{
// some code
}
}
我尝试调用构造函数:
RDTiffDataAccess.IRDTiffData Rdt1 = new RDTiffDataAccess.RDTiffDataClass();
它给了我一个错误:
Interop type 'RDTiffDataAccess.RDTiffDataClass' cannot be embedded. Use the applicable interface instead.
我通过更改Embed Interop Types = false
搜索并尝试了可能的解决方案。
现在它编译好了,但在运行时,会抛出异常:
Retrieving the COM class factory for component with CLSID failed
due to the following error: 80040154 Class not registered
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
我该如何解决这个问题?
答案 0 :(得分:0)
我知道这是一个老问题,但可以帮助其他人。 尝试在“构建”部分将项目属性更改为x86平台目标。 也许dll是针对86位构建的。