How to add dll search path? (2.0)

T

Tomasz Jastrzebski

Hi All,

Is there any way I can specify additional dll search path, preferably in
web.config, which would be used by asp.net 2.0 when binding assemblies?
I have many dlls shared among applications and I prefer not to add them to
the GAC, but also I do not want to keep/manage multiple copies in every web
application's folder.

Thank you for any hints.

Tomasz
 
S

Steven Cheng[MSFT]

Hello Tomasz,

As for the dll search path, it is called assembly probing path of .net
framework runtime. For normal .net framework application, at runtime when
it load a certain assembly, it will go through the following steps to
locate the assembly:

#How the Runtime Locates Assemblies
http://msdn2.microsoft.com/en-us/library/yx7xezcf.aspx


** if strong-named, first check GAC

** if there is a <codebase> setting for the matche assembly, the code base
location will be used:

#<codeBase> Element
http://msdn2.microsoft.com/en-us/library/efs781xb.aspx

Note that if the assembly has a strong name, the codebase setting can be
anywhere on the local intranet or the Internet. If the assembly is a
private assembly, the codebase setting must be a path relative to the
application's directory.


** looking for the assembly in application's private probing path, and here
it will differ for different .net applications:

1) for normal winform or console application, by default the private
assembly probing path is the same directory of the application root
directory. And we can add additional sub directories for probing through
app.config file:

#<probing> Element
http://msdn2.microsoft.com/en-us/library/823z9h8w.aspx

2)if the application is ASP.NET web application, it always uses the fixed
"bin" sub directory as the only probing path. We can not add additional one
because ASP.NET CLR host is a customized host.


Therefore, for your scenario, if your common assemblies are strong-named,
you can put them into GAC to make them globally shared. If they're not
strong-named, it will be hard for them to share among multiple ASP.NET
applciations due to the existing limitation.

BTW, though it is not supported at .net /ASP.NET level, we can consider
using the windows NTFS's symbolic links(hard link) feature to link one
physical file directory to another physical file directory. You can have a
look at the "Symbolic links" feature to see whether it helps you some:


#Symbolic links in Windows
http://www.thierryb.net/site/Symbolic-links-in-Windows.html


There is also a tool from sysinternals site that can help create symbolic
links conveniently.


#Sysinternals Freeware - Junction
http://www.sysinternals.com/Utilities/Junction.html

Thus, you can link your mutiple application's private bin path to the same
physical directory(if they will not have other non-shared assembly which
has conflict name).

Hope this helps. Please feel free to let me know if you have any questions
on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hello Tomasz,

How are you doing on this issue? Have you got any further ideas or does the
information in my last reply help you a little? Please feel free to let me
know if there is anything we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top