HighTechTalks DotNet Forums  

Consuming COM Obj In A .NET Assembly From A Different .NET Assembly

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Consuming COM Obj In A .NET Assembly From A Different .NET Assembly in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bowman, John C.
 
Posts: n/a

Default Consuming COM Obj In A .NET Assembly From A Different .NET Assembly - 04-20-2009 , 05:29 PM






Hi All,

I've got an interop problem I need some help with & I'm very green at .NET
interop. Assume I have .NET A.DLL that exposes a COM object that is running
under A.EXE (also a .NET app) that has been registered using Regasm.exe. Now
assume I've got .NET B.DLL (running under .NET B.EXE) that needs to consume
the COM object exposed by A.DLL. When I set a reference in B.DLL's project
to A.DLL, that reference requires that a copy of A.DLL now be either in the
GAC (not an acceptable solution for other reasons) or in the local install
folder where B.DLL resides. This means that we have to distribute A.DLL with
application B.EXE & D.DLL - which we don't like either. If I try to set the
reference in B.DLL's project to the .TLB available from A.DLL, then VS 2005
complains I can't do that & I need to set the reference directly to the
A.DLL assembly.

I know that if A.DLL were an unmanaged .DLL that exposed a COM object, then
a simple interop assembly is created when B.DLL is compiled and that interop
assembly get's distributed. That's OK. But since A.DLL is a .NET assembly we
seem to be forced to distribute A.DLL w/ B.LL. What I'd really like is the
equivalent to the simple interop dll for A.DLL. Is there some way to do this
(manifest(s) and/or some sort of interop assembly?) where we don't have to
distribute A.DLL w/ B.DLL?

TIA,

John


Reply With Quote
  #2  
Old   
Bowman, John C.
 
Posts: n/a

Default Re: Consuming COM Obj In A .NET Assembly From A Different .NET Assembly - 04-21-2009 , 07:34 AM






Hi All,

Sorry about the double post, my email client crash when I sent it and I
thought it didn't go through...

John

"Bowman, John C." <john.bowman (AT) thermofisher (DOT) com> wrote

Quote:
Hi All,

I've got an interop problem I need some help with & I'm very green at .NET
interop. Assume I have .NET A.DLL that exposes a COM object that is
running under A.EXE (also a .NET app) that has been registered using
Regasm.exe. Now assume I've got .NET B.DLL (running under .NET B.EXE) that
needs to consume the COM object exposed by A.DLL. When I set a reference
in B.DLL's project to A.DLL, that reference requires that a copy of A.DLL
now be either in the GAC (not an acceptable solution for other reasons) or
in the local install folder where B.DLL resides. This means that we have
to distribute A.DLL with application B.EXE & D.DLL - which we don't like
either. If I try to set the reference in B.DLL's project to the .TLB
available from A.DLL, then VS 2005 complains I can't do that & I need to
set the reference directly to the A.DLL assembly.

I know that if A.DLL were an unmanaged .DLL that exposed a COM object,
then a simple interop assembly is created when B.DLL is compiled and that
interop assembly get's distributed. That's OK. But since A.DLL is a .NET
assembly we seem to be forced to distribute A.DLL w/ B.LL. What I'd really
like is the equivalent to the simple interop dll for A.DLL. Is there some
way to do this (manifest(s) and/or some sort of interop assembly?) where
we don't have to distribute A.DLL w/ B.DLL?

TIA,

John


Reply With Quote
  #3  
Old   
TDC
 
Posts: n/a

Default Re: Consuming COM Obj In A .NET Assembly From A Different .NETAssembly - 04-22-2009 , 08:39 AM



I had to read that twice to get what you were after, but I've got it
now.

If all you are doing is trying to expose the COM definition which is
in "A", but not the implementation which is in "A", then you need to
pull the COM definition out of "A" into another library, lets call it
"Z", and then both "A" and "B & D" reference "Z".

What I don't fully understand in your question is where COM comes into
play at all. All your components you listed you said were .NET?



On Apr 20, 5:29*pm, "Bowman, John C." <john.bow... (AT) thermofisher (DOT) com>
wrote:
Quote:
Hi All,

I've got an interop problem I need some help with & I'm very green at .NET
interop. Assume I have .NET A.DLL that exposes a COM object that is running
under A.EXE (also a .NET app) that has been registered using Regasm.exe. Now
assume I've got .NET B.DLL (running under .NET B.EXE) that needs to consume
the COM object exposed by A.DLL. When I set a reference in B.DLL's project
to A.DLL, that reference requires that a copy of A.DLL now be either in the
GAC (not an acceptable solution for other reasons) or in the local install
folder where B.DLL resides. This means that we have to distribute A.DLL with
application B.EXE & D.DLL - which we don't like either. If I try to set the
reference in B.DLL's project to the .TLB available from A.DLL, then VS 2005
complains I can't do that & I need to set the reference directly to the
A.DLL assembly.

I know that if A.DLL were an unmanaged .DLL that exposed a COM object, then
a simple interop assembly is created when B.DLL is compiled and that interop
assembly get's distributed. That's OK. But since A.DLL is a .NET assemblywe
seem to be forced to distribute A.DLL w/ B.LL. What I'd really like is the
equivalent to the simple interop dll for A.DLL. Is there some way to do this
(manifest(s) and/or some sort of interop assembly?) where we don't have to
distribute A.DLL w/ B.DLL?

TIA,

John


Reply With Quote
  #4  
Old   
Bowman, John C.
 
Posts: n/a

Default Re: Consuming COM Obj In A .NET Assembly From A Different .NET Assembly - 04-24-2009 , 11:52 AM



Thanks for the tip TDC,

The reason COM is there in the first place is that it's an older component
that is used by several other app's. But now we need to use it in an
isolated/local fashion w/ registration free. That's where we're trying to
get too w/ this.

John

"TDC" <NOtcarvinSPAM (AT) lycos (DOT) com> wrote

I had to read that twice to get what you were after, but I've got it
now.

If all you are doing is trying to expose the COM definition which is
in "A", but not the implementation which is in "A", then you need to
pull the COM definition out of "A" into another library, lets call it
"Z", and then both "A" and "B & D" reference "Z".

What I don't fully understand in your question is where COM comes into
play at all. All your components you listed you said were .NET?



On Apr 20, 5:29 pm, "Bowman, John C." <john.bow... (AT) thermofisher (DOT) com>
wrote:
Quote:
Hi All,

I've got an interop problem I need some help with & I'm very green at .NET
interop. Assume I have .NET A.DLL that exposes a COM object that is
running
under A.EXE (also a .NET app) that has been registered using Regasm.exe.
Now
assume I've got .NET B.DLL (running under .NET B.EXE) that needs to
consume
the COM object exposed by A.DLL. When I set a reference in B.DLL's project
to A.DLL, that reference requires that a copy of A.DLL now be either in
the
GAC (not an acceptable solution for other reasons) or in the local install
folder where B.DLL resides. This means that we have to distribute A.DLL
with
application B.EXE & D.DLL - which we don't like either. If I try to set
the
reference in B.DLL's project to the .TLB available from A.DLL, then VS
2005
complains I can't do that & I need to set the reference directly to the
A.DLL assembly.

I know that if A.DLL were an unmanaged .DLL that exposed a COM object,
then
a simple interop assembly is created when B.DLL is compiled and that
interop
assembly get's distributed. That's OK. But since A.DLL is a .NET assembly
we
seem to be forced to distribute A.DLL w/ B.LL. What I'd really like is the
equivalent to the simple interop dll for A.DLL. Is there some way to do
this
(manifest(s) and/or some sort of interop assembly?) where we don't have to
distribute A.DLL w/ B.DLL?

TIA,

John


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.