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

C# DLL-plugin references

Tim
Hi,

I've been struggling for a while trying to run plugins in C#, which
have external references.
The plugins load, and I can invoke methods through reflection until
the method uses some code defined in an external assembly.

The error returned is in all cases:

"Could not load file or assembly 'MyAssName, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.".

The only sollution I could find so far, is to manually add references
to these assemblies in the host project, which defies the purpose of
the plugin-system.

Is there a way, without using the GAC, to reference these assemblies
at runtime?

Thanks in advance,
Tim

Jul 11 '07 #1
3 3330
Tim

Ensure:
1. the assemblies you're wanting to reference are in the same folder as the
executing assembly when calling Assembly.LoadFrom(...DLL name...)
2. you pass in the fully qualified object name (prefixed with namspace
information) when calling GetType on your assembly.

To check what object types are available in a DLL, you can call GetTypes on
the Assembly, which returns an array of available types.

Good luck!
Dan.

"Tim" <Ti**********@gmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,

I've been struggling for a while trying to run plugins in C#, which
have external references.
The plugins load, and I can invoke methods through reflection until
the method uses some code defined in an external assembly.

The error returned is in all cases:

"Could not load file or assembly 'MyAssName, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.".

The only sollution I could find so far, is to manually add references
to these assemblies in the host project, which defies the purpose of
the plugin-system.

Is there a way, without using the GAC, to reference these assemblies
at runtime?

Thanks in advance,
Tim

Jul 11 '07 #2

"Tim" <Ti**********@gmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,

I've been struggling for a while trying to run plugins in C#, which
have external references.
The plugins load, and I can invoke methods through reflection until
the method uses some code defined in an external assembly.

The error returned is in all cases:

"Could not load file or assembly 'MyAssName, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.".

The only sollution I could find so far, is to manually add references
to these assemblies in the host project, which defies the purpose of
the plugin-system.

Is there a way, without using the GAC, to reference these assemblies
at runtime?
The way I do it, is after I load each assembly, iterate through its
dependencies, and for each assembly not yet loaded, try to load it from the
plugin directory as well.
>
Thanks in advance,
Tim

Jul 11 '07 #3
Tim
On 11 jul, 17:22, "Daniel Bass"
<danREMOVEb...@blueCAPSbottle.comFIRSTwrote:
Tim

Ensure:
1. the assemblies you're wanting to reference are in the same folder as the
executing assembly when calling Assembly.LoadFrom(...DLL name...)
2. you pass in the fully qualified object name (prefixed with namspace
information) when calling GetType on your assembly.

To check what object types are available in a DLL, you can call GetTypes on
the Assembly, which returns an array of available types.

Good luck!
Dan.

"Tim" <Tim.Vanla...@gmail.comwrote in message

news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,
I've been struggling for a while trying to run plugins in C#, which
have external references.
The plugins load, and I can invoke methods through reflection until
the method uses some code defined in an external assembly.
The error returned is in all cases:
"Could not load file or assembly 'MyAssName, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.".
The only sollution I could find so far, is to manually add references
to these assemblies in the host project, which defies the purpose of
the plugin-system.
Is there a way, without using the GAC, to reference these assemblies
at runtime?
Thanks in advance,
Tim
Thanks for your reply, Daniel.
This allowed me to run the plugin properly!

Jul 12 '07 #4

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

Similar topics

1
by: Stefan | last post by:
Hi, I just downloaded PHP-4.3.3 for win32 and got the extensions folder and dropped it intot he root of the PHP directory and set it's path in the PHP.ini: extension_dir =...
3
by: Matthias Baas | last post by:
Hi, are there any guidelines about what to do if a Windows extension for Python 2.4 requires the C++ runtime (msvcp71.dll)? If I want to distribute a binary installer of an extension that...
4
by: Programmer | last post by:
Hi everyone Well here is my problem I hope you can help me
4
by: Matt Sawyer | last post by:
I am attempting to use an API (CxApiOem.dll) that has a large number of defines and complicated structs. It's just too much hassle to attempt to use DLLImport to make the desired API calls. ...
11
by: Vijay Chegu | last post by:
I have built a 64bit ATL COM dll. When i register the dll on IA64 windows Enterprise server 2003, i get following error. DllRegisterServer in mydll.dll failed. Return code was : 0x80020009 ...
2
by: Kevin R. | last post by:
I have been ignoring this problem for a few weeks now, but it's becoming a bit annoying not to mention unproductive. Here it goes: I compile my project with no errors. Then after I debug/run it,...
4
by: james margey | last post by:
Hi to all, I have spent 3 days at this error and i have two days to go for a deadline, and i am about to go off my nut, the reason being: Microsoft dont seem to be able to provide a solution, I...
15
by: z. f. | last post by:
Hi, i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL. for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it...
0
by: HeroOfSpielburg | last post by:
Hello, I'm new to the realm of .NET application creation, so please forgive my ignorance. I have been tasked with debugging a problem that arises with using a DLL that contains managed and...
1
by: jabbari | last post by:
Hello, Please Help us...! I have a big problem ,so i searched on google and other search engine ,then I realized that so many other people have the same problem and they, all, have'nt been able to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.