1

I have created a COM dll in C#.net, and calling a method of COM dll from VCPP code.

The creation of COM dll also result in a tlb file creation, after reading about it found that I need to register the tlb file using regasm to make a registry entry of it.

Now if I am running the application on a machine where Microsoft Visual Studio is not installed, then I wont be able to register the tlb file using regasm, also when I attempt to register the tlb file using regsvr32 its giving an error message.

Is there a work around for it?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Haseena Shaikh
  • 49
  • 1
  • 1
  • 4

1 Answers1

0

You don't need to register the .tlb file - you have to use regasm with /codebase parameter to register the COM .dll file. You need to run regasm on every machine where you want to use your COM .dll via COM. regasm is shipped and installed with .NET framework, so if it's not available it means you can't use your COM DLL since the latter requires .NET runtime anyway.

Also see this question.

Community
  • 1
  • 1
sharptooth
  • 167,383
  • 100
  • 513
  • 979
  • I have done the development on a developer machine and now i would like to test it on windows server 2008 without visual studio installed and took all the binaries(depended dll(s), COM dll and tlb file and also the .exe file written in VCPP to call COM method),could you please tell me how should i proceed to test the exe – Haseena Shaikh Aug 03 '11 at 09:36
  • You'll need the VC++ reditributable and .NET framework on that machine. You'll have to copy both the .dll and the program .exe there, register the .dll with regasm and run the .exe. – sharptooth Aug 03 '11 at 09:38
  • Thanks for your help!!I am able to register the COM dll using Regasm.exe , but when i try to register the same COM dll on 64 bit machine i am getting the following exception RegAsm : error RA0000 : Failed to load 'C:\Binaries\GCOM.dll' be cause it is not a valid .NET assembly. I used the below cmd o register the dll G:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe GCOM.dll /tlb:GCOM.tlb /codebase – Haseena Shaikh Aug 03 '11 at 10:34
  • Got It!! I am able to register it on 64 bit machine. Build the COM dll with Any CPU. – Haseena Shaikh Aug 03 '11 at 11:10