我正在为 Navision 2009 SP1(经典客户端)开发一份报告,其中出现了对 NAV 中不可用的额外功能的需求。
我在 C# 中创建了一个 COM dll,安装了它(使用 InstallShield“免费”vs 版本)并在 NAV 中创建了一个自动化变量。类和接口是可见的,我看到了 Print 方法,但是当我尝试创建变量时,我收到以下错误:
“无法创建由...标识的 OLE 控件或自动化服务器的实例。请检查 OLE 控件或自动化服务器是否已正确安装和注册。”
这是代码(只是试图建立连接):
[ComVisible(true), Guid("080a97fb-321c-4a2f-b948-dd52ce263415"), InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IPrinterTest
{
[DispId(1)]
bool Print(string test, string bytesInStringRepresentation);
}
[ClassInterface(ClassInterfaceType.None), ComVisible(true), Guid("8d7b85a9-1a20-4ea0-a7d4-decf26632eee"), ProgId("Printer.PrinterTest")]
public class PrinterTest : IPrinterTest
{
public PrinterTest()
{
}
public bool Print(string test, string bytesInStringRepresentation)
{
return true;
}
}
生产环境只有 .NET Framework 客户端配置文件(3.5 和 4.0),这意味着 Regasm 可用(在 4.0 中)而 gacutil 不可用。
我假设我的代码有问题而不是 InstallShield,因为 dll 可用于在 Navision 中选择,并且当我尝试创建 nav 自动化变量时会出现问题。
最好的问候马库斯