Hello everyone,
I am debugging and learning MSDN C# COM server sample.
http://msdn2.microsoft.com/en-us/library/aa645738(vs.71).aspx
I am using Regasm to generate Windows Registry scripts, here it is,
I can understand that for C# COM Server, since it is managed code, it will
use mscoree.dll as the entry point. But I can not see anything related to the
real codebase dll (CSharpServer.dll), which contains the real implementation
of coclass and interface definition.
I am wondering how mscoree.dll find and invoke real implementation in
CSharpServer.dll?
[code]
REGEDIT4
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
@="CSharpServer.InterfaceImplementation"
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
@="{C6659361-1625-4746-931C-36014B146679}"
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
@="CSharpServer.InterfaceImplementation"
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
@="mscoree.dll"
"ThreadingModel"="Both"
"Class"="CSharpServer.InterfaceImplementation"
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"
"RuntimeVersion"="v2.0.50727"
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
"Class"="CSharpServer.InterfaceImplementation"
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"
"RuntimeVersion"="v2.0.50727"
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
@="CSharpServer.InterfaceImplementation"
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
[/code]
thanks in advance,
George
Cezary Nolewajka - 19 Jul 2007 13:40 GMT
Hi,
I was working lately on COM implementation in .Net and found out that
running regasm with tlb option registers as well the full path to tlb and
the directory where the dll (assembly). is placed.
When you look into registry, in the TypeLib subkey for registered classes
you have the Guid of the key that contains the information.
This is located in: \\HKCR\TypeLib\[YourGuid]
I don't know why the generated registry information does not contain this
bit.
Some good articles on .Net COM development can be found here:
http://www.codeproject.com/useritems/BuildCOMServersInDotNet.asp
http://www.codeproject.com/dotnet/nettocom.asp
Best regards,
Cezary Nolewajka
Consultant | Microsoft Services | Microsoft | Poland
> Hello everyone,
>
[quoted text clipped - 49 lines]
> thanks in advance,
> George
George - 21 Jul 2007 11:54 GMT
Thanks Cezary!
I have tested that you are correct! We have to use /tlb option.
I am writing C# COM server (managed code). Since there is no QueryInterface,
DllGetClassObject like in C++ native code, I am wondering how to know which
coclass is initialized and which method is invoking by client?
I have such question is because I only develop COM server, and there are
some dll level error (dll no longer available, something like this), so I
think COM client may use some coclass/methods which my COM server does not
support. But I do not have COM client source codes, so I am wondering how to
get the information (which coclass/method client is using).
thanks in advance,
George
> Hi,
>
[quoted text clipped - 72 lines]
> > thanks in advance,
> > George
Ben Voigt [C++ MVP] - 19 Jul 2007 18:00 GMT
> Hello everyone,
>
[quoted text clipped - 13 lines]
> I am wondering how mscoree.dll find and invoke real implementation in
> CSharpServer.dll?
This line:
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"
is the reference data used by mscoree to load managed assemblies.
> [code]
> REGEDIT4
[quoted text clipped - 31 lines]
> thanks in advance,
> George
George - 20 Jul 2007 13:48 GMT
Hi Ben,
How do you think from the following line,
> "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
> PublicKeyToken=null"
mscoree.dll will find the actual codebase -- CSharpServer.dll? Why it could
find this CSharpServer.dll, other than some other dll?
(I have this question since from the registry line you quoted, there is no
information about CSharpServer.dll).
regards,
George
> > Hello everyone,
> >
[quoted text clipped - 55 lines]
> > thanks in advance,
> > George