【发布时间】:2017-08-07 13:06:43
【问题描述】:
我正在为 Navision 2009 SP1(经典客户端)开发一份报告,其中出现了对 NAV 中不可用的额外功能的需求。
我在 C# 中创建了一个 COM dll,安装了它(使用 InstallShield“免费”与版本)并在 NAV 中创建了一个自动化变量。类和接口是可见的,并且我看到了 Print 方法,但是当我尝试 CREATE 变量时,我收到以下错误:
“无法创建由.....标识的 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 Client Profile(3.5 和 4.0),这意味着 Regasm 可用(在 4.0 中)而 gacutil 不可用。
我假设我的代码有问题,而不是 InstallShield,因为 dll 可以在 Navision 中选择,并且当我尝试创建 nav 自动化变量时会出现问题。
最好的问候 马库斯
【问题讨论】:
-
我不了解这里的投票文化,我真的不了解。如果您觉得我的问题不令人满意,为什么不在评论中告诉我为什么?如果你不让我知道我做错了什么,我就无法改进。
-
错误发生在
CREATE(NameAutomationVariable)行? -
是的,当我执行“CREATE(NameAutomationVariable)”时会发生错误。如果我使用 CREATE 的结果,它总是返回 false。
-
确保 dll 是 x86 并尝试使用 gacutil 来检查它是否解决了问题
标签: c# interop navision dynamics-nav dynamics-nav-2009