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: Mon, 30 Jul 2007 19:14:23 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Anthony LaMark
          2    Mattias Sjgren


Advice on dynamically loading .Net assembly when cscript.exe is the hosting process   
Hi All,

I have a .Net Assembly that is COM enabled (COM-Interop) and so is 
instantiated and used in vbscript and jscript.  I install it into the GAC 
(during our installation program).  This assembly has dependencies on other 
..net assemblies (from another companion product) to run.  These dependency 
assemblies are not put into the GAC though.  When I compile my assembly, I 
have the companion product assemblies defined as references within the 
Visual Studio project.  I can find where the dependency assemblies are on 
the hard drive by going to the registry though so I can determine their 
location.  My current problem is that at run-time I cannot use app.config 
file to do load the dependent .net assemblies (because the host process is 
cscript.exe which is in Windows\system32), rather I am hoping to be able to 
have a hook in my .Net Assembly to be able to load the dependency 
assemblies.  I have read over Assembly.Load and so it looks do-able but I 
think I need to not link the dependencies into the dll (i.e. static link) 
since I can see that when the system loads my assembly, it is trying to 
resolve the dependency assemblies as well.  I see this with fuslogvw.exe. 
Any advice would be greatly appreciated!
Date:Mon, 30 Jul 2007 19:14:23 -0700   Author:  

Re: Advice on dynamically loading .Net assembly when cscript.exe is the hosting process   

>I have read over Assembly.Load and so it looks do-able but I 
>think I need to not link the dependencies into the dll (i.e. static link) 
>since I can see that when the system loads my assembly, it is trying to 
>resolve the dependency assemblies as well.  I see this with fuslogvw.exe. 


The dependencies shouldn't be loaded until they are actually needed.
If you can hook up a handler to the AppDomain.AssemblyResolve event
before using anything from the dependency assemblies you should be
able to handle it from there.


Mattias

-- 
Mattias Sjgren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Date:Tue, 31 Jul 2007 10:53:36 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


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