Phil Wilson
11/30/2007 1:31:00 AM
I think that's correct, yes, you can't have a .NET client with a .NET COM
object (because you can just add the assembly reference to the client
anyway). Internally there'd be a RCW talking to a CCW, and I don't believe
that works.
--
Phil Wilson
[MVP Windows Installer]
"Ben" <Ben@discussions.microsoft.com> wrote in message
news:D887BF6A-867F-481F-85AA-03F229256325@microsoft.com...
> So you can write COM components in .NET but you cant use such COM
> components
> from .NET as COM components? Is that it?
>
> "Ben" wrote:
>
>> I have a COM server executable, written in .NET. I exported a type
>> library
>> and registered it.
>>
>> So now I can create an instance of the component using CreateInstance
>> from
>> non .NET code. That works fine. I can also get hold of the instance by
>> calling GetObject from non .NET code.
>>
>> So at this point I have the server running, but I also want to talk to it
>> from .NET clients.
>>
>> If I try to add the the exported type library to a .NET client, I get an
>> error that I I can't add the type library because it was exported from a
>> .NET
>> component and that I should add the assembly instead.
>>
>> So I can add the assembly as a reference. If I then call
>> Marshall.GetActiveInstance, then I can not cast it using
>> Marshall.CreateWrapperOfType it gives me a type mismatch error because
>> the
>> type is not derived from a COM object.
>>
>> I want to be able to talk to the already running COM server instance from
>> another .NET application. But it wont let me because that COM instance
>> was
>> written in .NET!
>>
>> How do I get around it please?