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 / January 2005

Tip: Looking for answers? Try searching our database.

Locate assemblies referenced by the interop dll

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Perry van Kuppeveld - 29 Dec 2004 10:56 GMT
Hi,

I have the following situation:

In one folder on the harddisk i have a lot off vb stuff, i.e. C:\VBProg
In this folder there are several dll and exe files, all vb6.

I also have on the same harddisk a lot off dotnet stuff, in C:\DotNetProg
In this folder also several dll and exe files, all dotnet.

I have to write a communication between the 2 environments, so i wrote a
dotnet dll which is registered for com interop in the C:\DotNetProg folder.
This dll has multiple references to other dll files in this dotnet folder.

I started writing a vb program using this communication dll. As long as this
program is in the DotNetProg everything goes well. I would like to place
this in VBProg folder, becourse it also is going to reference several vb6
dll files. If i do this, there is a assembly loading problem.

Is it possible to tell dotnet where to find all assemblies referenced by the
interop dll?

Perry
Mattias Sj?gren - 29 Dec 2004 11:06 GMT
Perry,

>Is it possible to tell dotnet where to find all assemblies referenced by the
>interop dll?

You'd have to register the .NET library with Regasm.exe /codebase to
write its full path to the Registry so it can be found (or place it in
the GAC).

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Perry van Kuppeveld - 29 Dec 2004 11:18 GMT
I have done this. As long as the interop dll doesn't refer to other dlls
this works.
But , i think, as soon as this interop dll references other dotnet dlls, the
clr tries to locate these referenced dlls in the app domein, and not on the
location of the interop dll.

I don't want to use the GAC. This will trigger a cascade of referenced dlls
to register in the GAC.

Perry

> Perry,
>
[quoted text clipped - 7 lines]
>
> Mattias
Mattias Sj?gren - 29 Dec 2004 12:26 GMT
Perry,

>But , i think, as soon as this interop dll references other dotnet dlls, the
>clr tries to locate these referenced dlls in the app domein, and not on the
>location of the interop dll.

Right. To solve that you could make the VB app a runtime host that
explicitly sets the appbase directory to DotNetProg. Or you make your
interop library handle the AppDomain.AssemblyResolve event and
explicitly load assemblies from that directory.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Perry van Kuppeveld - 29 Dec 2004 13:40 GMT
Setting the appbase sounds ok, but how do i do this.........
Perry van Kuppeveld - 29 Dec 2004 15:49 GMT
Handeling the AssemblyResolve event looks like an option.
The only question is: How / where do i subscribe on this event as there's no
Dll entry point.

Do you have a sample or link on this?

Thanks,

Perry

> Perry,
>
[quoted text clipped - 10 lines]
>
> Mattias
Mattias Sj?gren - 05 Jan 2005 22:03 GMT
>Handeling the AssemblyResolve event looks like an option.
>The only question is: How / where do i subscribe on this event as there's no
>Dll entry point.
>
>Do you have a sample or link on this?

I don't know what would work in your application, perhaps you could
set it up in a static constructor.

No sample, sorry.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


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.