.NET and COM

K

kanaille11

Hi,
at the moment we're experiencing path issues. From what I know, a .NET-
assembly is looked up
1) in the GAC
2) in the EXE's directory
3) if specified in the app.config-file, in a subdirectory or in an
arbitrary location

What I need to know is this:
we have a COM-component (written in .NET) which references a .NET-
assembly with some business logic. Let's say these DLLs are in d:
\TheProject\bin\debug. The COM-dll is registered with
regasm SomeCOM.dll /codebase

A test application is under c:\program files\TestApp and opens that
COM-component. Although the .NET-assembly doesn't meet any of the 3
criteria, it can be loaded. Why is that? Where is that specified? Is
this always the case when using COM-components?

mfg Steven
 
T

theinvisibleGhost

Hi,
at the moment we're experiencing path issues. From what I know, a .NET-
assembly is looked up
1) in the GAC
2) in the EXE's directory
3) if specified in the app.config-file, in a subdirectory or in an
arbitrary location

What I need to know is this:
we have a COM-component (written in .NET) which references a .NET-
assembly with some business logic. Let's say these DLLs are in d:
\TheProject\bin\debug. The COM-dll is registered with
regasm SomeCOM.dll /codebase

A test application is under c:\program files\TestApp and opens that
COM-component. Although the .NET-assembly doesn't meet any of the 3
criteria, it can be loaded. Why is that? Where is that specified? Is
this always the case when using COM-components?

mfg Steven

I think you'll find performing a regasm /codebase will register
the DLL in the registry, including the location of the DLL.
Presumably the other part of your application is requesting the COM
interface from
the registry and the registry shows where the DLL Is located.
 
K

kanaille11

I think you'll find performing a regasm /codebase will register
the DLL in the registry, including the location of the DLL.
Presumably the other part of your application is requesting the COM
interface from
the registry and the registry shows where the DLL Is located.

That's right, that's the COM way of locating DLLs. But why is the
referenced .NET-assembly found?
It should be loaded with .NET's standard mechanism. As it seems to me
the codebase is enhanced
when the COM-module is loaded. If that's true, this should be
documented somewhere - but I can't find
it :-(
 
T

theinvisibleGhost

That's right, that's the COM way of locating DLLs. But why is the
referenced .NET-assembly found?
It should be loaded with .NET's standard mechanism. As it seems to me
the codebase is enhanced
when the COM-module is loaded. If that's true, this should be
documented somewhere - but I can't find
it :-(

Am I getting this right
Test Application references a COM Interface
You've got a .NET assembly wrapped in a COM wrapper,
which in turn references a .NET assembly?

If so I'd expect the wrapped .NET code to find any referenced DLL's in
the same directory as the wrapped .NET assembly location, unless told
otherwise.

I've got some code which does this, for a plugin for an media player
written with MFC.
 
K

kanaille11

Am I getting this right
Test Application references a COM Interface
You've got a .NET assembly wrapped in a COM wrapper,
which in turn references a .NET assembly?

If so I'd expect the wrapped .NET code to find any referenced DLL's in
the same directory as the wrapped .NET assembly location, unless told
otherwise.

I've got some code which does this, for a plugin for an media player
written with MFC.

Yes, that's exactly our environment.
But you know what: I just found the bug that caused me headaches for
days. It didn't had to do with
assembly loading...I wanted to make sure with this post that assembly
loading this way is 100% legal
and not the reason for our problems.

So thanks for your answers,

mfg Steven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top