473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Loading Dll assemblies at runtime

JH
Is it possible to load an assembly at runtime using reflection where the dll
does not have a strong name and is not in the GAC?

If not, is it possible to put an assembly into the GAC without a strong
name?

I'm using the code below (which fails on the load as it needs an assembly
name not a full path)

// Get list of dll's in a specific path
FileInfo[] dllList = GetAssemblyNames(szAssemblyPath);
foreach (FileInfo fi in dllList)
{
Assembly asm = Assembly.Load(fi.FullName);
Nov 16 '05 #1
5 7289
Assembly.LoadFile?
I have never used it myself, though.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"JH" <jo**@spamme.com> wrote in message
news:uq**************@TK2MSFTNGP14.phx.gbl...
Is it possible to load an assembly at runtime using reflection where the
dll
does not have a strong name and is not in the GAC?

If not, is it possible to put an assembly into the GAC without a strong
name?

I'm using the code below (which fails on the load as it needs an assembly
name not a full path)

// Get list of dll's in a specific path
FileInfo[] dllList = GetAssemblyNames(szAssemblyPath);
foreach (FileInfo fi in dllList)
{
Assembly asm = Assembly.Load(fi.FullName);
.
.
DoStuff()
.
}
Cheers,
John

Nov 16 '05 #2
Look at Assembly.LoadFrom which takes the path to the assembly (its CODEBASE)

or Assembly.Load which takes the assembly name and will run the assembly resolution algorithm to find the assembly.

If the target assembly has no strong name Assembly.Load will only look under the application directory (the APPBASE)and sub directories

You cannot put an assembly without a strong name in the GAC as without a strong name there is no way the assembly loader can distinguish between two assemblies with the same name from different authors, and we're back to DLL Hell

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<uq**************@TK2MSFTNGP14.phx.gbl>

Is it possible to load an assembly at runtime using reflection where the dll
does not have a strong name and is not in the GAC?

If not, is it possible to put an assembly into the GAC without a strong
name?

I'm using the code below (which fails on the load as it needs an assembly
name not a full path)

// Get list of dll's in a specific path
FileInfo[] dllList = GetAssemblyNames(szAssemblyPath);
foreach (FileInfo fi in dllList)
{
Assembly asm = Assembly.Load(fi.FullName);
Nov 16 '05 #3
Assembly assembly = Assembly.LoadWithPartialName(name);
"JH" wrote:
Is it possible to load an assembly at runtime using reflection where the dll
does not have a strong name and is not in the GAC?

If not, is it possible to put an assembly into the GAC without a strong
name?

I'm using the code below (which fails on the load as it needs an assembly
name not a full path)

// Get list of dll's in a specific path
FileInfo[] dllList = GetAssemblyNames(szAssemblyPath);
foreach (FileInfo fi in dllList)
{
Assembly asm = Assembly.Load(fi.FullName);
.
.
DoStuff()
.
}
Cheers,
John

Nov 16 '05 #4
JH <jo**@spamme.com> wrote:
Is it possible to load an assembly at runtime using reflection where the dll
does not have a strong name and is not in the GAC?
Yes.
If not, is it possible to put an assembly into the GAC without a strong
name?

I'm using the code below (which fails on the load as it needs an assembly
name not a full path)


Look at Assembly.LoadFrom and Assembly.LoadFile.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
JH
"Richard Blewett [DevelopMentor]" <ri******@develop.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Look at Assembly.LoadFrom which takes the path to the assembly (its CODEBASE)
or Assembly.Load which takes the assembly name and will run the assembly resolution algorithm to find the assembly.
If the target assembly has no strong name Assembly.Load will only look under the application directory (the APPBASE)and sub directories
You cannot put an assembly without a strong name in the GAC as without a strong name there is no way the assembly loader can distinguish between two
assemblies with the same name from different authors, and we're back to DLL
Hell


Cheers guys, I've used Assembly.LoadFrom() and it works fine. Starting to
see that "DLL Hell" phrase popup everywhere recently!
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dale cyr | last post by:
nick: hope i'm not stating the obvious for you, but you *are* aware, i presume, that your loading app wants to find the loaded app in the loading app's runtime directory, or a sub directory of...
3
by: RickN | last post by:
We have a C# remoting application that runs thru the web. Assemblies appear to be loaded from the download cache. Is there any way to have them automatically copied to the GAC and be loaded from...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
0
by: Verane | last post by:
Hi all, I am working with C# and Visual studio 2003. What I want to do is the following : I have 3 assemblies, let call them A.exe, B.dll and C.dll. I want to dynamically load B and C when A...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
4
by: Barry Kelly | last post by:
I'm designing an application framework which will, amongst other things, live in an assembly hosted in the ASP.NET worker process, servicing webservice requests. Here's the scenario: APPFX is...
0
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the...
1
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works...
8
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a...
3
by: -Lost | last post by:
Runtime dependency loading, worth the trouble? I've been researching methods of "dynamically" loading and unloading dependencies at runtime (trying my best to think of a nice solution of loading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.