Navision自动化C#COM DLL [英] Navision automation C# COM DLL

查看:85
本文介绍了Navision自动化C#COM DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们创建了一个C#类库项目,用于与外部Web服务进行通信。当我们选中为COM互操作注册时,此DLL将自动注册并准备在发生注册的PC上使用。然后,该PC上的Navision客户端可以使用自动化变量来找到此DLL并使用它。

We have created a C# class library project to talk to external webservices. When we check "register for COM interop" this DLL is automatically registered and ready for use on the PC where the registration occurred. The Navision client on that PC can then use an "automation" variable to find this DLL and use it.

我们需要将此DLL推广到生产环境。我们正在使用一种RDP解决方案,其中navision客户端在我们的用户使用的2台RDP服务器上运行。这意味着我们只需要能够将DLL部署到这两个服务器。
我们已经尝试了以下2种解决方案,这些解决方案已在此处和一些博客文章中找到:

We need to rollout this DLL to the production environment. We're working with an RDP solution where the navision client runs on 2 RDP servers which our users use. This means that we only need to be able to deploy the DLL to these 2 servers. We have tried the following 2 solutions we've found here and on several blog posts:


  • 将DLL拖到C: \windows\assembly(以管理员身份)

  • 使用REGASM注册DLL(REGASM ourDll.dll /tlb:ourDll.dll)

执行完这些后,我们在Navision中找到了我们尝试使用CREATE命令初始化的DLL:

After having executed these we've found the DLL in Navision which we tried to initialize using a CREATE command:

CLEAR(ourDll);
CREATE(ourDll);
IF ISCLEAR(ourDll) THEN
    CREATE(ourDll);

但是在此之后,我们收到以下错误(翻译版本):

But after this we receive the following error (translated version):


此消息适用于C / AL程序员:

This message is for C/AL programmers:

无法创建OLE控件或自动化服务器的实例由Automation Server标识为GUID = {guid} 1.0:{guid}:'ourDll'。消费

Could not create an instance of the OLE control or Automation Server identified by Automation Server with identification GUID={guid} 1.0:{guid}:'ourDll'.Consume

验证是否正确安装了OLE控件或自动化服务器,并且已注册。

Verify if the OLE-control or Automation server was correctly installed and registered.

在此之后,我们尝试运行GACUTIL / i ourDll.dll,将DLL安装到GAC中,但结果保持不变。既然完成了此操作,就会出现错误消息:

After this we tried to run GACUTIL /i ourDll.dll which installed our DLL into the GAC but the result remains the same. Since we've done this there's an errormessage:


文本对于缓冲区来说太长了。

The text is too long for the buffer.

但是,此错误似乎并没有停止编译的步伐。运行时的错误消息与上面相同。

However this error doesn't seem to stop navision of compiling. The error message on run stays the same as above.

推荐答案

我们能够解决此问题并在此处共享最终解决方案,以便遇到相同情况的人可能不需要花很多时间来解决这个问题:

We were able to resolve this and sharing the final resolution here so that people who get into the same situation might not need to spend the many hours we put into this:

问题不是向导或界面,而是REGASM的二手版本。 .NET Framework。

The problem was not the guids or interfaces but the used verson of REGASM of the .NET Framework.

由于目标框架为3.5,所以我们假设REGASM的版本也必须< = 3.5,我们还假设必须使用64位框架的REGASM。但是,经过大量的反复试验,我们似乎必须使用的版本是32位v4 REGASM(请参阅下面的用于注册的.bat文件),这解决了所有问题,并且我们的DLL现在很高兴在Navision中使用

Since the target framework was 3.5 we assumed that the version of REGASM also had to be <= 3.5, also we assumed that we had to use the REGASM of the 64-bit Framework. However after a good amount of trial and error it appeared that the version we had to use was the 32bit v4 REGASM (see our used .bat file for registration below), this resolved all issues and our DLL is now happily being used in the Navision client.

SET GACUTIL="C:\Program Files (X86)\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe"
SET REGASM="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\regasm.exe"
%REGASM% OurDll.dll /tlb:OurDll.tlb
%GACUTIL% /i OurDll.dll

这篇关于Navision自动化C#COM DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆