PC Review


Reply
Thread Tools Rate Thread

Changing search paths for assemblies at Runtime

 
 
=?Utf-8?B?bWljaGFlbA==?=
Guest
Posts: n/a
 
      16th Jan 2005
Is it possible to change the search path for an assembly at runtime from the
Application's folder or GAC to a different folder of choice? Specifically, I
have written a UserControl which in turn consumes other 3rd party assemblies.
I don't want to keep the 3rd party assemblies in the Application's folder nor
the GAC, however, I can't seem to find a way to change the path.


--
Michael Hockstein
 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      17th Jan 2005
Hi Michael,

Thanks for your posting. As for the changing search path(for assembly at
runtime) of the .net applicaiton, I think this can be done by using the
.net framework's assembly binding and redirection mechanism.

Generally, when the .net application find a certain type's not loaded and
then it'll try loading the type's host assembly. This will be divided into
two steps, assembly resolving and assemly locating:

1. The runtime checking which assembly should load, the assmebly's base
name, version, culture, publickeytoken ...

2. Try follow the locating steps to locate the actual assembly file.

And the locating steps will follow the following sequence:

1) GAC

2) CODEBASE setting (in config file)

3) file probing( appbase and sub probing folders)

So the codebase setting is the one you can make use of , first make sure
your assembly is strong-named
and then you can specify a URL path for each version of your assembly in
your application config file. Below is the <codebase> configure element's
reference in MSDN:

#<codeBase> Element
http://msdn.microsoft.com/library/en...eBase.asp?fram
e=true

#note that since the GAC checking is before codebase, if there is also the
same one in GAC, the GAC one will be used first.

In addition, ASP.NET dosn't support strong-named assembly in private bin
path and we recommend that you'd better put strong-named assemly in GAC for
asp.net applciations.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different Assemblies At Runtime Kulgan Microsoft ASP .NET 3 9th Aug 2007 06:20 PM
App Paths and Assemblies Ron Bremmers Microsoft Dot NET 2 12th Jun 2005 09:24 PM
Getting list of assemblies and their paths =?Utf-8?B?YmlsbGI=?= Microsoft C# .NET 3 24th Jan 2005 10:01 AM
Using assemblies in runtime? Janus Knudsen Microsoft C# .NET 2 12th May 2004 05:26 AM
Link Paths changing to UNC paths Gail Microsoft Excel Misc 0 13th Apr 2004 07:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:17 AM.