Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2007

Tip: Looking for answers? Try searching our database.

Exposing .Net Class to Com, Dependancy Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AsharGhani - 16 Feb 2007 07:10 GMT
Hi,

I am new to COM as well as to .Net COM interop. I want to expose a .Net
class(lets say (lets say A::ClassA) of an assembly (A ) to COM with a method
that returns an Object of another .Net class(B::ClassB). The problem is
ClassB has been defined in another assembly (B) that the assembly A refers
to. ( And Class B itself derives from 2 interfaces and a class all defined in
separate assemblies)

First of all is this possible? If yes will only exposing the Assembly A by
generating its type library and registering it through .Net's COM interop
utilities such as regasm?
I have tried using Regasm but it is giving some errors ( fails to load the
types from the referenced assembly, although i have copied all the required
assemblies to the same location as the assembly A).

I will be using this COM interface from a .NET assembly, but have to use COM
component's progid to instantiate an Object. ( a really twisted kind a
problem, ;) nice warm welcome to the interop world right?)

Anyway, Another option that came to mind was to somehow marshal the COM
object back to an object of the original class ( whose type i can access by
referencing to the .Net assembly A. now i can use a method that hasn't been
exposed through the class A's interface. This method wont give any errors
while registering the assembly. I want to know if its actually possible.

If there is any confusion i would happily elaborate it. Any Help would be
appreciated.

Thanks
Patrick Steele - 21 Feb 2007 21:45 GMT
> I am new to COM as well as to .Net COM interop. I want to expose a .Net
> class(lets say (lets say A::ClassA) of an assembly (A ) to COM with a method
[quoted text clipped - 4 lines]
>
> First of all is this possible?

It should be possible.  As long as you have GUIDs, interfaces, DISP ids,
etc... all set up properly.  I wrote an article on how to expose your
.NET objects to COM that might help you out:

http://www.15seconds.com/issue/040721.htm

Signature

Patrick Steele
http://weblogs.asp.net/psteele

AsharGhani - 12 Mar 2007 13:47 GMT
Thanks Patrick Steele!

will have a look at the article

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.