DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 8 Aug 2007 13:46:03 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    John Duddy


LoadFrom() searching wrong dir for unmanaged->COM->CLR->.NET remot   
I am using COM to integrate some .NET components into a legacy app, and am 
running into a difficulty with locating assemblies.

I have a C# class that is exposed vi COM interop, and registered as a COM 
object. I am creating it via CoCreateInstance (in-process) from an unmanaged 
C++ client.  Since all by assemblies are in a different location (call it 
"B") from my unmanaged exe (which lives in "A"), I created a config file with 
the assemblyBinding & probing sections. So far so good - I can create the COM 
instance and talk to the object all without putting it in the GAC. (BTW - I 
cannot put things in the GAC, so I need a non-GAC solution).

In my C# class, I execute a .NET Remoting server process EXE (call it Y.exe) 
in the same directory as my assembly (which is a subdirectory of where the 
unmanaged program is). This .NET EXE tries to use Assembly.LoadFrom() to 
dynamically load an assembly (call it X.dll) in its same directory and fails. 
It uses the unqualified path name. The error message in the exception 
indicates that it was looking for X.dll in "A" instead of "B".

My understanding was that being a separate program, Y.exe will search for 
assembies in the directory it was loaded from ("B"), rather than the 
directory of the process hosting the assembly that executed it ("A"). 
Instead, it seems to be looking in "A".

So, this is what I have:
A/
  unmanaged.exe
  unmanaged.exe.config (probing=B)
  B/
    managed_com.dll
    Y.exe
    X.dll

Any help is greatly appreciated.

Thanks -

John Duddy
PS - I got it to work by explicitly setting the current working directory of 
the Y.exe process when I start it. I want to make sure that is a safe 
work-around.
Date:Wed, 8 Aug 2007 13:46:03 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us