473,327 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

[C# COM development] output by Regasm

Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(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?

Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2.  
  3. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4. @="CSharpServer.InterfaceImplementation"
  5.  
  6. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7. @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10. @="CSharpServer.InterfaceImplementation"
  11.  
  12. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13. @="mscoree.dll"
  14. "ThreadingModel"="Both"
  15. "Class"="CSharpServer.InterfaceImplementation"
  16. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17. PublicKeyToken=null"
  18. "RuntimeVersion"="v2.0.50727"
  19.  
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21. "Class"="CSharpServer.InterfaceImplementation"
  22. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23. PublicKeyToken=null"
  24. "RuntimeVersion"="v2.0.50727"
  25.  
  26. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27. @="CSharpServer.InterfaceImplementation"
  28.  
  29. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George
Jul 19 '07 #1
4 2338
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...rsInDotNet.asp
http://www.codeproject.com/dotnet/nettocom.asp

Best regards,
Cezary Nolewajka

Consultant | Microsoft Services | Microsoft | Poland

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(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?

Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  3. @="CSharpServer.InterfaceImplementation"
  4. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  5. @="{C6659361-1625-4746-931C-36014B146679}"
  6. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  7. @="CSharpServer.InterfaceImplementation"
  8. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  9. @="mscoree.dll"
  10. "ThreadingModel"="Both"
  11. "Class"="CSharpServer.InterfaceImplementation"
  12. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  13. PublicKeyToken=null"
  14. "RuntimeVersion"="v2.0.50727"
  15. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  16. "Class"="CSharpServer.InterfaceImplementation"
  17. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  18. PublicKeyToken=null"
  19. "RuntimeVersion"="v2.0.50727"
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  21. @="CSharpServer.InterfaceImplementation"
  22. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  23. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  24.  


thanks in advance,
George
Jul 19 '07 #2

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(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?
This line:
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"

is the reference data used by mscoree to load managed assemblies.
>
Expand|Select|Wrap|Line Numbers
  1. REGEDIT4
  2. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  3. @="CSharpServer.InterfaceImplementation"
  4. [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  5. @="{C6659361-1625-4746-931C-36014B146679}"
  6. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  7. @="CSharpServer.InterfaceImplementation"
  8. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  9. @="mscoree.dll"
  10. "ThreadingModel"="Both"
  11. "Class"="CSharpServer.InterfaceImplementation"
  12. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  13. PublicKeyToken=null"
  14. "RuntimeVersion"="v2.0.50727"
  15. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  16. "Class"="CSharpServer.InterfaceImplementation"
  17. "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  18. PublicKeyToken=null"
  19. "RuntimeVersion"="v2.0.50727"
  20. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  21. @="CSharpServer.InterfaceImplementation"
  22. [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  23. Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  24.  


thanks in advance,
George

Jul 19 '07 #3
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

"Ben Voigt [C++ MVP]" wrote:
>
"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(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?

This line:
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"

is the reference data used by mscoree to load managed assemblies.

Expand|Select|Wrap|Line Numbers
  1.  REGEDIT4
  2.  
  3.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4.  @="CSharpServer.InterfaceImplementation"
  5.  
  6.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7.  @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10.  @="CSharpServer.InterfaceImplementation"
  11.  
  12.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13.  @="mscoree.dll"
  14.  "ThreadingModel"="Both"
  15.  "Class"="CSharpServer.InterfaceImplementation"
  16.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17.  PublicKeyToken=null"
  18.  "RuntimeVersion"="v2.0.50727"
  19.  
  20.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21.  "Class"="CSharpServer.InterfaceImplementation"
  22.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23.  PublicKeyToken=null"
  24.  "RuntimeVersion"="v2.0.50727"
  25.  
  26.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27.  @="CSharpServer.InterfaceImplementation"
  28.  
  29.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30.  Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George


Jul 20 '07 #4
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

"Cezary Nolewajka" wrote:
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...rsInDotNet.asp
http://www.codeproject.com/dotnet/nettocom.asp

Best regards,
Cezary Nolewajka

Consultant | Microsoft Services | Microsoft | Poland

"George" <Ge****@discussions.microsoft.comwrote in message
news:74**********************************@microsof t.com...
Hello everyone,
I am debugging and learning MSDN C# COM server sample.

http://msdn2.microsoft.com/en-us/lib...38(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?

Expand|Select|Wrap|Line Numbers
  1.  REGEDIT4
  2.  
  3.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
  4.  @="CSharpServer.InterfaceImplementation"
  5.  
  6.  [HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
  7.  @="{C6659361-1625-4746-931C-36014B146679}"
  8.  
  9.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
  10.  @="CSharpServer.InterfaceImplementation"
  11.  
  12.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
  13.  @="mscoree.dll"
  14.  "ThreadingModel"="Both"
  15.  "Class"="CSharpServer.InterfaceImplementation"
  16.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  17.  PublicKeyToken=null"
  18.  "RuntimeVersion"="v2.0.50727"
  19.  
  20.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
  21.  "Class"="CSharpServer.InterfaceImplementation"
  22.  "Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
  23.  PublicKeyToken=null"
  24.  "RuntimeVersion"="v2.0.50727"
  25.  
  26.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
  27.  @="CSharpServer.InterfaceImplementation"
  28.  
  29.  [HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
  30.  Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
  31.  

thanks in advance,
George

Jul 21 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kevin Flanagan | last post by:
This can be reproduced with VS.NET as follows. Create a new ATL project with default wizard settings (dll, attributed). To the 'module' attribute, add a specifier 'version = "1.10" ' alongside the...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, TlbExp.exe and Regasm.exe tools aid us in exporting assembly information to a type library so that non .Net Applications or unmanaged code use this type library information to call...
2
by: Id L | last post by:
hi, i want to use gacutil.exe and regasm.exe but i don't want to install "all" .net framework SDK do you know if i can install only these 2 methods? or maybe i can use them without installing...
2
by: Sara | last post by:
I have written a class and tried to register it using regasm.exe using regasm myTest.dll /tlb:myTest.tlb tlb file got generated and i got dll registered successfully msg. but when i go and...
2
by: Kenneth Jonsson | last post by:
I have an COM server in an assembly. When it is deployed on a target computer it needs to be registred with RegAsm. I created a custom action in the deploy project, starting RegAsm with the...
0
by: rbanerji | last post by:
I have a COM object built in C#. Its a an IE deskband. It implements the following method: public static void Register( Type t ) Which gets called when regasm is used and it makes teh...
1
by: auad | last post by:
hi, I would like to register a dll (regasm) during the execution of my setup using custom actions. I don't know where to place the parameters for regasm in the custom action. I tried using "...
2
by: gopal | last post by:
I installed MS DevEnv 2003 with framework 1.1.I developed a small application which looks out for the assembly vcersion of a .net DLL or EXE via code. But i have a problme durng the registration...
2
by: xamman | last post by:
hi there, i am trying to use a .NET assembly from a Cscript.exe .vbs (i.e. from COM) and could not get my .vbs to use my .net dll (gives a 'file not found error') unless i used the /codebase...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.