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

dll not found when changing the path

Hi everyone, sorry about my english. Im having a problem and i don't know how to fix it.

I have a plugin-based application that i'm developing. Every plugin has a reference to a dll that has different static classes with functions. When i run the application with all the dlls (plugins and their references) in the same directory, the application works fine. But the problem comes when i change the application's path, leaving the dlls in other path. When i run the application, the plugin dll thrown an exception saying that the "functions dll" could not be found, but the dll is in the same directory as the plugin :| .

If i don't explain well:
C:\app.exe
C:\plugin.dll
C:\functions.dll
It works fine.

C:\test\app.exe
C:\plugin.dll
C:\functions.dll
It doesn't work.

I don't know where is the problem.
I'll be really grateful for your help.

Thanks
Greetings
Nov 20 '09 #1
13 3107
GaryTexmo
1,501 Expert 1GB
Well, it depends on the code you have to load your plugins. However, I'm betting it's just looking in the working directory (ie, LoadPlugin("plugin.dll") or some such thing.

That's why it's not finding the plugins... it's likely looking in the same directory app.exe is running out of, so when you change that it won't find them. I bet if you moved your two plugin dlls into the c:\test folder, it would work again.

You've got a couple of options (that I can think of)...

1) Keep your plugins in the same directory as your application. This is fine as long as you keep your plugins with your application (though you may want to put them in a plugins folder (ie, ".\plugins\plugin.dll" and ".\plugins\functions.dll")

2) Hard code your plugins folder. Instead of loading by the plugin name, fully qualify it (ie, "c:\plugin.dll" and "c:\functions.dll"). I wouldn't recommend this since it's pretty restrictive. You may want to deploy your app on other computers and users may not want things to always go in the same folder.

3) Allow your app to configure the path to the plugins folder. This is especially good if you want your plugins to be loaded from any arbitrary location.

Of the three, the third is probably the "best" solution as it gives you the most freedom; however, the first is also perfectly acceptable. I've written a plugin system myself and I actually used the first solution (though I had my plugins in a subfolder off my working directory) that involved relative file links.

Hopefully one of those helps you, or at least helps you think of a better way of doing it. Good luck!
Nov 20 '09 #2
Hi, thanks a lot for your reply, but the problem is not the application, its in the plugin, because when i put the application in the plugin directory, it works fine, but when i put the application in another directory, it founds the plugin, but the plugin doesn't "see" the functions dll =S. i think its like the plugin uses the application "startup path" to "search for the references"(functions dll), and when the plugin and the application are in the same directory, it works fine, but when i move the application to another path, the plugin searchs for the references in the application's new path. i don't have idea what could be.
Nov 20 '09 #3
GaryTexmo
1,501 Expert 1GB
Oh I see, plugin.dll needs to find function.dll?

Again, I don't really have your code, but does plugin.dll look for function.dll by just asking for the directory? If so, that would be the problem, since the working directory is for app.exe. You'll need to direct plugin.dll to look for function.dll in the same directory plugin.dll was found in. App.exe should be able to tell you where it found plugin.dll.

Sorry for the confusion.
Nov 20 '09 #4
The plugin is a "class proyect library" that references to the "functions dll". is there anyway to "tell" the plugin that the "functions dll" is "there with him"?

i've tried to set the current directory in the app, but it still happening =S

thanks
Nov 20 '09 #5
GaryTexmo
1,501 Expert 1GB
Is plugin.dll a project that you built, then included functions.dll as a reference?
Nov 20 '09 #6
exactly :) the plugin.dll is a "class proyect library" that has a reference to "functions.dll"
Nov 20 '09 #7
Frinavale
9,735 Expert Mod 8TB
Hi tincho87,

Do you have control over the plugin.dll code?
Could you take a look at how it is referencing the functions.dll?
Nov 20 '09 #8
hi, the plugin is loaded in the app by the System.Reflection, i mean, its not referenced. But the "plugin proyect" has referenced the "functions.dll"(References->Add reference. Then, i select the "functions.dll" and import their functions by the "using namespace")
Nov 20 '09 #9
GaryTexmo
1,501 Expert 1GB
@tincho87
Hmm, interesting.

I don't suppose it would be possible for you to register functions.dll with the GAC, would it? Then plugin.dll could load it from there instead of a file in a folder...

This particular issue has never come up for me, but I guess I would have assumed things were smart enough to figure out how to load references for themselves.

So yea, give the GAC a try... here's a link I found with google on how to do this.
http://www.dotnetspider.com/forum/Vi...?ForumId=16430
Nov 21 '09 #10
hi, i discovered something strange: when i put the "functions dll" in the same path of the app, it works!. i think that the plugin is searching for the reference in the path of the app...but why?

C:\app.exe
C:\plugin.dll
C:\functions.dll
It works fine.

C:\test\app.exe
C:\plugin.dll
C:\functions.dll
It doesn't work.
C:\test\app.exe
C:\plugin.dll
C:\test\functions.dll
It works too.
Nov 21 '09 #11
Hi, this image could help.

Nov 24 '09 #12
Hi everyone. I found the solution!
I used the app.config to add a private path, and its now working!! :)

Thanks
Nov 26 '09 #13
Frinavale
9,735 Expert Mod 8TB
I'm really happy that you found a solution!


Congrats :)

-Frinny
Nov 26 '09 #14

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

Similar topics

5
by: TimS | last post by:
I am getting a baffling File not found error (0x800A0035). I am writing asp on a windows 2000 server. I build a path and filename from several fields in a jet database using SQL commands, like...
0
by: Mec | last post by:
Some time ago I created a windows forms application with a deployment project. I was always able to build the deployment package after changing the windows forms application, but somehow something...
0
by: Figmo | last post by:
I have an ATL project that originally was developed in VS6. It has a custom build setting to register the component after it compiles the project (inserted for me by the VS6 wizard). I just...
6
by: Stan | last post by:
There are over 200 people using the intranent web site and only one computer has a very strange problem. The web page has a button. When the button is clicked, the form is posted back and...
8
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
4
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
1
by: aapexclient | last post by:
I have a problem with Java finding my custom class directory. I have searched the forums and tried everything, but nothing seems to work. The <javapgm>.java compiled cleanly and created...
18
by: freeheel | last post by:
Hello, I'm dynamicaly adding controls to report. It's working fine but in one computer it throws "path not found .\ VB.temp" error. The VB.temp name is changing to VBA.temp, VBC.temp........
1
Dököll
by: Dököll | last post by:
Greetings, Good buddies! I am for the first time, since I started learning VB, going to build an application I wanted to build for my first son, a language and activities program that will allow...
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
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
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
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
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,...
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.