473,407 Members | 2,312 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,407 software developers and data experts.

Register .NET assembly as COM component with REGASM

Hi -

I have a C# .NET assembly that exposes a COM interface (basically has an
interface and class with Guid attributes).

If I compile this under VS.NET (with the "Register for COM Interop"
selected). Then I can import the TLB into C++ and use the component as a
standard COM component, it creates and I can call it's methods.

If however, I take the DLL and use REGASM to register the component. I
cannot use the component, the application reports that the class is not
registered (CreateInstance fails)!

Can anyone tell me what else I need to do in order to register the
component? VS.NET appears to be doing something else that is making the
component accessible!

I would also like to register the component from another .NET application
(without using REGASM). I believe the key to this is the RegistrationService
class, but I appear to be experiencing the same problem with this as the
REGASM problem above (i.e. class not registered)!

I have the following code, which incidently doesn't return any errors (or
throw any exceptions):

Assembly asm = Assembly.LoadFile (@"c:\temp\ImageConverter.dll");

RegistrationServices reg = new RegistrationServices ();

reg.RegisterAssembly (asm, 0);

Any help is greatly appreciated?

TIA

- Andy
Nov 15 '05 #1
2 13523
Andy,
Can anyone tell me what else I need to do in order to register the
component? VS.NET appears to be doing something else that is making the
component accessible!
VS.NET effectively does the same as running RegAsm with the /codebase
option.

reg.RegisterAssembly (asm, 0);


Passing AssemblyRegistrationFlags.SetCodeBase as the second parameter
corresponds to /codebase.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Thanks, that appears to the missing option and parameter. It works.

- Andy

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:u1**************@tk2msftngp13.phx.gbl...
Andy,
Can anyone tell me what else I need to do in order to register the
component? VS.NET appears to be doing something else that is making the
component accessible!


VS.NET effectively does the same as running RegAsm with the /codebase
option.

reg.RegisterAssembly (asm, 0);


Passing AssemblyRegistrationFlags.SetCodeBase as the second parameter
corresponds to /codebase.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 15 '05 #3

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

Similar topics

0
by: Boomessh | last post by:
Hai all, can any one help me in solving he following problem? I am registering a COM+ component in a machine. While registering i am getting the following error. ...
0
by: glenn | last post by:
I understand that you can not use regsvr32 to register a .NET COM Server and you must use the regasm program in order to do this. However, regasm is not in any windows paths and on my system I...
3
by: Max | last post by:
Is there a way to register an assembly programatically?
3
by: Antonio | last post by:
Hi everybody, I have created a class library (dll) with "Register for COM Interop" option enabled, but the problem is when I try use this dll in another computer with out VS.NET and I use regsvr32...
4
by: Mihiri | last post by:
Hi, I have created a simple managed component in vb.Net with a public class exposing a public function. I successfully registered it using 'Regasm.exe' .. But when I tired to access it in vb...
7
by: John\\ | last post by:
I created a simple DLL called: MyDLL I have been trying to register it so I can see it in the COM References; Regsvr32 does not work for .NET DLL RegAsm - seems to work, but I can not select...
2
by: Geoffrey | last post by:
Hello, I create a COM object in c# to use some new functionnality in old softawre. On my dev platform, I register the component on build (option register for com interop) On production...
6
by: Yoavo | last post by:
Hi, How can I register a c# class ? Yoav.
8
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am using Visual Studio 2005 to develop a C# COM Class Library project. There is a setting in Build --Output, called *Register for COM Interop*. What is the usage of this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.