473,811 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 RegistrationSer vice
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.LoadFi le (@"c:\temp\Imag eConverter.dll" );

RegistrationSer vices reg = new RegistrationSer vices ();

reg.RegisterAss embly (asm, 0);

Any help is greatly appreciated?

TIA

- Andy
Nov 15 '05 #1
2 13542
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.RegisterAss embly (asm, 0);


Passing AssemblyRegistr ationFlags.SetC odeBase 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.o rg> wrote in message
news:u1******** ******@tk2msftn gp13.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.RegisterAss embly (asm, 0);


Passing AssemblyRegistr ationFlags.SetC odeBase 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
1360
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. ************************************************************ System.EnterpriseServices.RegistrationException: Failed to register assembly 'LR.Server.TransactionManager, Version=1.0.0.1, Culture=neutral, PublicKeyToken=e0e8e60ed826fed8'. ---> System.UnauthorizedAccessException:...
0
1095
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 have two different versions of the program. So when I get ready to deploy to a users machine, what is the best method to use to register the component? Thanks, glenn
3
9536
by: Max | last post by:
Is there a way to register an assembly programatically?
3
1732
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 to register it, this send a message: "LoadLibrary(dllname) failed - The specified module could not be found", what I need to do to use the dll in another machine? Thanks in advance
4
2214
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 6.0( using late binding) it gives an error . I cannot view managed component in Ole View . Both managed componet and vb 6.0 exe are in the same folder. How Can I successfully register my component for COM? Thanks
7
7412
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 the DLL from the Add COM References. I can not choose Browse as this is not an option in the application I am
2
2773
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 platform (tested with a Win98), I register the COM object with regasm. I see on the registry, that the component is installed (like on my dev pc : guid, ....).
6
3064
by: Yoavo | last post by:
Hi, How can I register a c# class ? Yoav.
8
7325
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 setting? In my situation, do I need to set this option? thanks in advance,
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10663
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10401
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10138
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9217
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7676
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3881
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3029
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.