Re: COM interop, pathing from .NET
From: jwallison (jwallison_at_nospam.net)
Date: 07/28/04
- Next message: jwallison: "Re: COM interop, pathing from .NET"
- Previous message: BMermuys: "Re: Help with marshaling string"
- In reply to: Troy: "COM interop, pathing from .NET"
- Next in thread: jwallison: "Re: COM interop, pathing from .NET"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 10:41:33 -0400
"Troy" <Troy@discussions.microsoft.com> wrote in message
news:38949575-98A8-48FF-9701-5664DCED9E4E@microsoft.com...
> I am having a problem which does not occur on all machines. I have a C#
DLL that is being accessed by a VB6 app. After specifying COM interop on
the C# project, and also using regasm /tlb on the deployed machine, the VB6
app will only 'find' the C# DLL if it located in the same directory. The C#
DLL has been registered and resides in the winnt\system32 directory, which
is in the path.
>
> Apologies if this is basic, but I could not find anything on this and only
recently ran into this problem.
===============================================
See the following:
MSDN: Working with Assemblies and the Global Assembly Cache
"In addition, you do not have to install assemblies into the global assembly
cache to make them accessible to COM interop or unmanaged code."
The following also apply:
MSDN: Exposing .NET Framework Components to COM
MSDN: Registering Assemblies with COM
If you want the down and dirty on the process that takes place when the CLR
probes for assemblies, try the Fusion Log View tool (fuslogvw.exe) - it will
show the assembly probing that takes place when an app tries to "find" a
.Net assembly.
If you are using an Installer class for your assembly, you can set the path
to your assembly by the following:
// Override the 'Install' method of the Installer class.
public override void Install( IDictionary mySavedState )
{
base.Install( mySavedState );
...
RegistrationServices rs = new RegistrationServices();
// get refererence to your assembly
Assembly asm;
... (use Assembly.GetAssembly("yourtypename") etc. here to get a
reference to your assembly)
// set the CodeBase for your assembly
rs.RegisterAssembly( asm, AssemblyRegistrationFlags.SetCodeBase); //
allows CLR to find the assembly when invoked from COM
...
}
-- Regards, Jim Allison jwallison.1@digitalcollimation.com(de-mung by removing '.1')
- Next message: jwallison: "Re: COM interop, pathing from .NET"
- Previous message: BMermuys: "Re: Help with marshaling string"
- In reply to: Troy: "COM interop, pathing from .NET"
- Next in thread: jwallison: "Re: COM interop, pathing from .NET"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|