Excel的.NET COM - 自动化错误。该系统找不到指定的文件找不到、错误、文件、系统

2023-09-03 15:54:11 作者:爱你丶纯属意外

我有在Excel中使用VBA一个.NET 2.0的COM对象。它工作正常,在我的dev的机器,而是尝试使用它干净的虚拟机工作站上,当我得到这个错误:

I have a .NET 2.0 COM object that's used by VBA in Excel. It works fine on my dev machine, but when trying to use it on a clean VM workstation I get this error:

自动化错误。 该系统找不到指定的文件。

Automation error. The system cannot find the file specified.

这个dll被注册regasm / TLB / codeBase的mycom.dll,而不是放在GAC。 我没有在虚拟机中的管理权限

The dll is registered with "regasm /tlb /codebase mycom.dll" and not put in the GAC. I don't have administration rights on the VM box

任何想法?

推荐答案

您需要可以调用regasm的完整路径组件设置为 codeBase的参数值或将组装成某个位置始终是搜索库的路径。否则,当客户端尝试实例化COM对象不会被发现。

You need to either invoke regasm with the full path to the assembly as the codebase parameter value or put the assembly into some location which is always on the path for searching libraries. Otherwise it will not be found when the client tries to instantiate the COM object.