473,399 Members | 2,159 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,399 software developers and data experts.

Using Reflection to load DLLs from subdirectories?

Greetings,

I have a C# application that uses Reflection to scan through a directory, ./plugins/, for assemblies that have been assigned the PluginAttribute and loads them.

This part works beautifully. I can create new plugins, copy them into the ./plugins/ directory, the application finds them and loads them. Cool. For basic ./plugins/ this all works great.

The problem that I am running into is when plugins are a bit more complicated and have references to other projects. The referenced project gets compiled and the referenced DLL accompanies the plugin's DLL in the ./plugins/ folder.

.NET doesn't like this. When the plugin is instantiated a FileNotFound exception is thrown. If I move the DLL referenced by the plugin from ./plugins/ to ./ then all works great.

I don't want to do this though. I want the referenced DLL to stay with the plugin. :) How can I leave it the referenced DLL in ./plugins/ and inform .NET to look in that directory for the assembly rather than only looking ./?

I have tried adding the ./plugins/ directory to the Reference Paths tab in the project Properties for each of the projects involved to no avail.

I found an article from somebody else who had this problem. They worked around the issue by wiring up an AppDomain.CurrentDomain.AssemblyResolve event handler to load an assembly via Reflection then dismantling the event handler but that seems like an ugly workaround.

Is there a better way?

Cheers!
Andy P
Aug 17 '07 #1
0 1460

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: forvino | last post by:
Hi Geeks, Ihave a doubt in dotNet reflection. I m developing a tool which will returns set of public(access specifier) methods of the selected assembly. this works completely fine,...
1
by: Martin Platt | last post by:
Guys! I've been playing about with some code trying to get the satellite assembly resource files to work. From what I understand you must have a fallback for a particular language, as well as...
3
by: TT (Tom Tempelaere) | last post by:
Hi there I am making a service project in C#, and I'm in the process of writing the installer. I made an installer class by using the "Add Installer" menu-item in the design window of the service,...
6
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found...
2
by: forvino | last post by:
Hi Geeks, Ihave a doubt in dotNet reflection. I m developing a tool which will returns set of public(access specifier) methods of the selected assembly. this works completely fine,...
1
by: Stampede | last post by:
Hello, I've a problem with loading classes with the Reflection API of .NET2.0. What I want to do is the following: I have a directory which has several subdirectories with DLLs and an EXE File....
0
by: Reini | last post by:
We are developing an Asp.Net 2.0 application (Web Administration) for the IIS 5.0 to 6.0 and the W2K to W2K3 operating system. The application consists of several layers. One layer is a .Net 2.0...
1
by: DaveK | last post by:
I am developing a Windows Forms App in C# (2005). Rather than install the app on each client and then have to update each client with new versions, is it possible for each client to dynamically...
4
by: Vince Castellano | last post by:
Hello, I have a set of DLLs that implement different configurations of the same API. Consider them as first.dll, second.dll, and third.dll. They all share a common API, calling pattern, and have...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.