如何将 .NET 程序集注册为 COM? [英] How to register a .NET assembly as COM?

查看:20
本文介绍了如何将 .NET 程序集注册为 COM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地机器上为工作流创建了一个类库并构建了它.我将完整的解决方案移至 Tridion 服务器并尝试使用 regasm.exe 工具在服务器中注册程序集,如下所示:

I have created a class library for a workflow on a local machine and build that. I moved the complete solution to a Tridion server and tried to register the assembly in the server using regasm.exe tool as below:

C:UserXYZDesktop>RegAsm codebase F:WorkflowWorkflowHandler/bin/debug/WorkflowHandler.dll

我收到以下错误:

未能加载'F:WorkflowWorkflowHandler/bin/debug/WorkflowHandler.dll' 因为它不是有效的 .NET 程序集.

failed to load 'F:WorkflowWorkflowHandler/bin/debug/WorkflowHandler.dll ' because it is not a valid .NET Assembly.

我的服务器详细信息:

64 位、Windows Server 2008 R2 Enterprise 和 .NET Framework 4 已安装.

64-bit, Windows Server 2008 R2 Enterprise, and .NET Framework 4 installed.

推荐答案

你确定你的路径中有正确的 RegAsm 因为你只是通过 exe 名称调用它而不指定完整路径?您必须调用正确版本的 RegAsm 才能使其工作,即 .NET 4 的 32 位或 64 位版本.

Are you sure you have the right RegAsm in your path since you're calling it by exe name only without specifying the full path? You must call the right version of RegAsm for it to work, i.e 32 or 64-bit version of .NET 4.

尝试指定完整路径:

c:WindowsMicrosoft.NETFrameworkv4.0.30319RegAsm.exe /codebase F:WorkflowWorkflowHandlerindebugWorkflowHandler.dll

c:WindowsMicrosoft.NETFramework64v4.0.30319RegAsm.exe /codebase F:WorkflowWorkflowHandlerindebugWorkflowHandler.dll

我还注意到在你的程序集的路径中有一些 / 字符而不是 .确保您放置在正确的路径中.

Also I noticed that in the path to your assembly you had some / characters instead of . Make sure you're putting in the correct path.

这篇关于如何将 .NET 程序集注册为 COM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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