我如何注册用C#编写Regsvr32的同一个COM DLL? [英] How do I register a COM DLL written in C# with Regsvr32?

查看:304
本文介绍了我如何注册用C#编写Regsvr32的同一个COM DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用COM DLL VB6的应用程序。该DLL是用C#。在C#项目属性我有注册为COM互操作选项选中。在VB6应用程序工作正常,我的机器上。在C#code以下格式完全相同: $ C $的CProject C#示例COM

I have a VB6 application that uses a COM DLL. The DLL is written in C#. In the C# project properties I have the "Register for COM interop" option checked. The VB6 app works fine on my development machine. The C# code follows this format exactly: CodeProject C# COM Example

当部署到其它机器上,Regsvr32.exe的给了我下面的错误,当我尝试注册DLL:

When deploying to other machines, Regsvr32.exe gives me the following error when I try to register the DLL:

The module "MyCOM.dll" was loaded but the entry-point DLLRegisterServer was not found.

这是什么意思?没有教程/文档,我读过有关COM DLL的说一下入口点的DLLRegisterServer任何事情。

What does this mean? No tutorials/documentation I've read about COM DLLs say anything about "entry-point DLLRegisterServer".

我们有不同的机器上使用RegAsm.exe大问题,所以我们真的需要一个解决方案,我们可以regsvr32.exe的运行,而不是将为我们部署(如XP,Vista中,Windows 7 x86的任何机器工作机,64机等)

We have had MAJOR problems using RegAsm.exe on different machines, so we really need a solution where we can run regsvr32.exe instead that will work for any machine that we deploy to (i.e. XP, Vista, Windows 7, x86 machines, x64 machines, etc.)

什么我需要添加到我的C#code,使其注册,能够与regsvr32.exe的?

What do I need to add to my C# code to make it register-able with regsvr32.exe?

推荐答案

您不能。管理[标记有ComVisible特性]类库需要与Regasm.exe注册。

You can't. Managed [ComVisible] class libraries need to be registered with Regasm.exe.

您可以从项目+属性的IDE做到这一点,建立标签,注册为COM互操作复选框。如果您运行Regasm.exe通常希望/ codeBase的命令行选项,这样你就不必把装配在GAC中。另一个选择是让Regasm.exe生成与/ REGFILE选项.reg文件。你只是在目标机器上获取注册表更新运行。

You can do it from the IDE with Project + Properties, Build tab, Register for COM interop checkbox. If you run Regasm.exe you usually want the /codebase command line option so you don't have to put the assembly in the GAC. Yet another option is to let Regasm.exe generate a .reg file with the /regfile option. You'd just run that on the target machine to get the registry updated.

编辑:刚刚看到了重大问题的话。注意:确保它们是什么,从/ codeBase的短。你必须挑上64位机器的正确版本。那里有两个。你需要提升的命令提示符,使UAC不制止它。

just saw the "major problems" remark. Note sure what they are, short from /codebase. You do have to pick the right version on 64-bit machines. There are two. And you need an elevated command prompt so that UAC don't put a stop to it.

这篇关于我如何注册用C#编写Regsvr32的同一个COM DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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