注册使用托管代码的COM对象 [英] registering a COM object that uses managed code

查看:60
本文介绍了注册使用托管代码的COM对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



1.我有一个用c ++编写的程序(客户端")(不是我写的),该程序被导出为COM对象. DLL需要在注册表中注册才能使用...

2.必须添加一些功能,我已经用c#(队列")编写了一个程序,在某些情况下客户端会使用该程序.

3.为了将它们连接在一起,我编写了一个cpp/cli wrapper("wrapper"),可以使用非托管代码中的托管代码.

4.现在,我有了:client.dll,wrapper.dll,queue.dll tat应该互相使用.
c#队列可以编译和工作,cpp/cli包装器可以编译并使用队列,客户端不会使用包装器对代码进行失败,但是现在无法为其注册输出.我得到:



1. I have a program ("client") written in c++ (not written by me) that is exported as a COM object. the DLL needs to be registered in the registry for it to be used...

2. Having to add some features to it, I have written a program in c# ("queue") that the client uses in some cases.

3. In order to connect them together, I have written a cpp/cli wrapper("wrapper"), that enables the use of managed code from unmanaged code.

4. Now I have: client.dll, wrapper.dll, queue.dll tat are supposed to use each other.
the c# queue compiles and works, the cpp/cli wrapper compiles and works with the queue, the client does not fail on the code using the wrapper, but failes to register output for it now. i get:

报价:

错误15错误 PRJ0050 :无法注册输出.请尝试启用每用户重定向"或从具有提升权限的命令提示符下注册组件.客户客户

Error 15 error PRJ0050: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. client client


(启用了按用户重定向)


5.有些人告诉我这无法完成-我无法在COM对象中使用托管代码(即使它位于其他DLL中?),有些人说可以,但是我还需要注册其他DLL,所以我在VS中添加:
-使装配COM可见.
-注册COM互操作.

现在C#队列无法注册,在这里我得到:


(per-user redirection is enabled)


5. Some tell me it can''t be done - i cannot use managed code in a COM object (even though it is in a different DLL?) and some say i can, but i need to register the other DLLs as well, so i add, in VS:
- make assembly COM visable.
- register for COM interop.

now the c# queue fails to register, here i get:

报价:

错误91错误 MSB8011 :无法注册输出.请尝试启用每用户重定向"或从具有提升权限的命令提示符下注册组件. C:\ Program Files \ MSBuild \ Microsoft.Cpp \ v4.0 \ Microsoft.CppCommon.targets 756 6包装器

Error 91 error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 756 6 wrapper



有什么想法吗?
能做到吗?
一个DLL是否关心它使用的DLL是托管代码还是非托管代码?
有没有简单的方法可以解决这个问题?.

希望我已经写了所有需要您帮助的信息.
thx.



any ideas?
can it be done?
does one DLL care if the DLLs it uses are managed code or unmanaged code?
is there a simple way to sort this out..?

Hope I have written all the info needed for your kind help.
thx.

推荐答案

如果存在问题,则可以创建托管COM对象.在构建部分中将其注册为COM库互操作.将其创建为ClassLibrary项目和项目属性.
You can make managed COM objects, if that is the question. Create it as ClassLibrary project, and project properties, in the build section set Register for COM interop.


这篇关于注册使用托管代码的COM对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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