.NET 2.0中的COM Interop问题 [英] COM Interop question in .NET 2.0

查看:59
本文介绍了.NET 2.0中的COM Interop问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我试图将我的.NET 2.0类暴露为COM类型,使用以下属性

属性


[ClassInterface(ClassInterfaceType.None)]

[Guid(" 8D0240AD-1BBE-4831-8214-39DD46A4A797")]


我有注册COM Interop build属性设置为true。我还在类中有两个函数来注册和注销带有

注册表的COM。但是当我尝试在VS.NET 2005中构建它时,我得到以下

错误XXX.dll不包含任何可以注册COM的类型

互操作"和XXX.dll不包含任何可以取消注册

COM Interop的类型。相同的代码在VS.NET 2003中完美运行。任何人都知道

出现这种情况的原因或我做错了什么?


谢谢,

Vish

解决方案

Vish,


这是一个错误构建过程,还是注册过程?

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Vish" <六** @ discussions.microsoft.com>在消息中写道

news:19 ********************************** @ microsof t.com ...



我试图将我的.NET 2.0类暴露为COM类型,使用属性的以下
属性

[ClassInterface(ClassInterfaceType.None)]
[Guid(" 8D0240AD-1BBE-4831-8214-39DD46A4A797")]

我有注册for COM Interop build属性设置为true。我还在类中有两个函数来注册和取消注册

注册表。但是当我尝试在VS.NET 2005中构建它时,我得到以下
错误XXX.dll不包含任何可以注册COM的类型
Interop和XXX.dll不包含任何可以取消注册的类型
COM Interop。相同的代码在VS.NET 2003中完美运行。任何人都知道

为什么会发生这种情况或我做错了什么?

谢谢你,
Vish



Vish,


默认情况下,ComVisible现在在2.0中可能是假的吗?试试

以下示例,看看它是否有效。


[ClassInterface(ClassInterfaceType.None)]

[Guid(" ; 8D0240AD-1BBE-4831-8214-39DD46A4A797))

[ComVisible(true)]

Jason Newell

Vish写道:



我试图将我的.NET 2.0类暴露为COM类型,使用属性的以下
属性

[ ClassInterface(ClassInterfaceType.None)]
[Guid(8D0240AD-1BBE-4831-8214-39DD46A4A797)]

我有Register for COM Interop build属性设置为true。我还在类中有两个函数来注册和注销带有
注册表的COM。但是当我尝试在VS.NET 2005中构建它时,我得到以下
错误XXX.dll不包含任何可以注册COM的类型
Interop和XXX.dll不包含任何可以取消注册的COM Interop类型。相同的代码在VS.NET 2003中完美运行。任何人都知道
为什么会发生这种情况或我做错了什么?

谢谢你,
Vish




" Vish" <六** @ discussions.microsoft.com>在消息中写道

news:19 ********************************** @ microsof t.com ...



我试图将我的.NET 2.0类暴露为COM类型,使用属性的以下
属性

[ClassInterface(ClassInterfaceType.None)]
[Guid(" 8D0240AD-1BBE-4831-8214-39DD46A4A797")]

我有注册for COM Interop build属性设置为true。我还在类中有两个函数来注册和取消注册

注册表。但是当我尝试在VS.NET 2005中构建它时,我得到以下
错误XXX.dll不包含任何可以注册COM的类型
Interop和XXX.dll不包含任何可以取消注册的类型
COM Interop。相同的代码在VS.NET 2003中完美运行。任何人都知道

为什么会发生这种情况或我做错了什么?

谢谢你,
Vish




不知道你在注册/取消注册

类的功能中究竟做了什么,介意发布你的代码?

Willy。


Hi,

I am trying to expose my .NET 2.0 class as a COM type using the following
attributes for the attributes

[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]

I have the "Register for COM Interop" build property set to true. I also
have two functions in the class to register and unregister the COM with the
registry. But when i try to build it in VS.NET 2005, i get the following
error "XXX.dll does not contain any types that can be registered for COM
Interop" and "XXX.dll does not contain any types that can be Unregistered for
COM Interop". The same code works perfectly in VS.NET 2003. Anybody know of
any reasons why this is happeneing or what i am doing wrong?

Thank You,
Vish

解决方案

Vish,

Is it an error in the build process, or the registration process?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Vish" <Vi**@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...

Hi,

I am trying to expose my .NET 2.0 class as a COM type using the following
attributes for the attributes

[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]

I have the "Register for COM Interop" build property set to true. I also
have two functions in the class to register and unregister the COM with
the
registry. But when i try to build it in VS.NET 2005, i get the following
error "XXX.dll does not contain any types that can be registered for COM
Interop" and "XXX.dll does not contain any types that can be Unregistered
for
COM Interop". The same code works perfectly in VS.NET 2003. Anybody know
of
any reasons why this is happeneing or what i am doing wrong?

Thank You,
Vish



Vish,

Could it be that ComVisible is false by default now in 2.0? Try the
following example and see if it works.

[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]
[ComVisible(true)]
Jason Newell
Vish wrote:

Hi,

I am trying to expose my .NET 2.0 class as a COM type using the following
attributes for the attributes

[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]

I have the "Register for COM Interop" build property set to true. I also
have two functions in the class to register and unregister the COM with the
registry. But when i try to build it in VS.NET 2005, i get the following
error "XXX.dll does not contain any types that can be registered for COM
Interop" and "XXX.dll does not contain any types that can be Unregistered for
COM Interop". The same code works perfectly in VS.NET 2003. Anybody know of
any reasons why this is happeneing or what i am doing wrong?

Thank You,
Vish




"Vish" <Vi**@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...

Hi,

I am trying to expose my .NET 2.0 class as a COM type using the following
attributes for the attributes

[ClassInterface(ClassInterfaceType.None)]
[Guid("8D0240AD-1BBE-4831-8214-39DD46A4A797")]

I have the "Register for COM Interop" build property set to true. I also
have two functions in the class to register and unregister the COM with
the
registry. But when i try to build it in VS.NET 2005, i get the following
error "XXX.dll does not contain any types that can be registered for COM
Interop" and "XXX.dll does not contain any types that can be Unregistered
for
COM Interop". The same code works perfectly in VS.NET 2003. Anybody know
of
any reasons why this is happeneing or what i am doing wrong?

Thank You,
Vish



Don''t know what exactly you do in the functions that register/unregister the
class, mind to post your code?
Willy.


这篇关于.NET 2.0中的COM Interop问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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