作者 主題: Add .net Component into COM  (閱讀 5221 次)

0 會員 與 1 訪客 正在閱讀本文。

小徒兒

  • 鑽研的研究生
  • *****
  • 文章數: 622
    • 檢視個人資料
Add .net Component into COM
« 於: 2005-08-15 07:52 »
1. new one Project : ComponentB ClassB method: HelloB
2. Add references on  .net

System.EnterPriseService
Microsoft Visual Basic Runtime Library

3.
using System.EnterpriseServices;
using Microsoft.VisualBasic;

4./Tool/build GUID/Registry Format

5. Copy and Past before Class constructor

[ComClass("B042CDBD-AE20-48ad-9180-9F2060706D8A","B042CDBD-AE20-48ad-9180-9F2060706D8B","B042CDBD-AE20-48ad-9180-9F2060706D8C")]
   public class ClassB
   

A B C , BC is write by your self arbitary

6. build the class

小徒兒

  • 鑽研的研究生
  • *****
  • 文章數: 622
    • 檢視個人資料
register the .dll file by tlb way
« 回覆 #1 於: 2005-08-15 07:58 »
in vs .net command tool
1. generate the key

sn -k key.snk

2. add in the project

[assembly: AssemblyKeyFile("key.snk")]

3. generate the tlb file for example the component nadmed componentB Class named ClassB

tlbexp ComponentB.dll /out:HelloB.tlb

4. register the dll
regasm /tlb:HelloB.tlb ComponentB.dll

5.Add this dll into Cache

gacutil /i ComponentB.dll

小徒兒

  • 鑽研的研究生
  • *****
  • 文章數: 622
    • 檢視個人資料
add the registered .dll into Com+ for remote procedure call
« 回覆 #2 於: 2005-08-15 08:06 »
1. control tool/component managemnt/add one application

this application is for network applicatioin and  互動式

2. add the component into the application

add new componenet
/visual studio project/Component B/bin/Debug/HelloB.tlb

小徒兒

  • 鑽研的研究生
  • *****
  • 文章數: 622
    • 檢視個人資料
call the dll file local
« 回覆 #3 於: 2005-08-15 08:07 »
代碼: [選擇]


<%

'Set obj=CreateObject("ClassLibraryA.ClassA")
'Set obj=CreateObject("ClassLibraryA.ClassA")

'Set obj=CreateObject("ADODB.Connection")
Set obj=CreateObject("ComponentB.ClassB")
's=obj.HelloB()
' s=obj.HelloA()
 Response.Write s

%>

小徒兒

  • 鑽研的研究生
  • *****
  • 文章數: 622
    • 檢視個人資料
export it as an msi file for people to install
« 回覆 #4 於: 2005-08-15 08:10 »
1. click the component you want to export then right click to export
choose the locattion
for example: C:/test.msi

and checked it as the proxy application

2. locate this file on the public folder that others can access
after they install, they can call the .dll file as the component is locally