The Artima Developer Community
Sponsored Link

.NET Buzz Forum
AssemblyResolve event of an AppDomain

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Samer Ibrahim

Posts: 55
Nickname: ibrahimss
Registered: Aug, 2003

Samer Ibrahim is a .NET programmer... I really don't want a long bio
AssemblyResolve event of an AppDomain Posted: Apr 29, 2004 6:58 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Samer Ibrahim.
Original Post: AssemblyResolve event of an AppDomain
Feed Title: Samer Ibrahim's Blog
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/SIbrahim/Rss.aspx
Feed Description: The Samer I Warrior on battles with .NET
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Samer Ibrahim
Latest Posts From Samer Ibrahim's Blog

Advertisement

I got a comment from a gentleman by the name of Anthony DeRosa asking for more details relating to how to load an assembly from a network location from my earlier post regarding the GAC.  So even though I found that this is addressed elsewhere when I googled for it what the heck another entry won't hurt anyone.

Let's start with the Assembly.LoadFrom method which most people are familar with.  One can easily load an assembly from a network location just using that method alone which may solve most people's problem.  But what if you want to be able to only load the assembly from a location if the .NET framework can't find it on it's own or you need some other algorithm to locate assemblies.  Little known to most people, beyond just the simple probing and checking of the GAC that .NET does, there is an event fired before the framework gives up on loading your assembly.  The event is AppDomain.AssemblyResolve.  You can subscribe to that event and do a simple Assembly.LoadFrom from a location known to you or even do some fancy loading of your own based on some system you engineer.  There are also TypeResolve and ResourceResolve events in the AppDomain that let you handle those aspects of resolving the various dependencies of an AppDomain.

Of course if you are loading an assembly off the network you need to make some CAS changes.

Just Googling for resources I found these:

Also just as an FYI, there is also a ModuleResolve event of an Assembly.

Read: AssemblyResolve event of an AppDomain

Topic: ASP.NET Partial-Trust web sites Previous Topic   Next Topic Topic: VB.Net to C#

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use