move dll to a separate directory

olgage

New member
Joined
Nov 14, 2006
Messages
4
Programming Experience
Beginner
I have some question about changing location of referenced DLL.
I have a solution with 7 projects. One of the projects (let’s call it ProjectA) uses an xxx.dll that is NOT .NET dll (it’s a dll of Java code, created by JBNBridge). Xxx.dll was added to the project using “Add”->”Existing Item”. Everything worked well till I got a requirement to hold all dlls in a separate external directory. I removed the dll item from the project, then I moved the dll file to the external directory and in the end I added the dll item from the external directory checking that the dll’s “Copy to Output Directory” label has value “copy always”. I rebuilt the project – successfully.
The compilation succeeded. BUT, when I run my project, I receive an unhandled JNBridge exception just in line I try to create an object from the dll.
When I returned the dll to his old place – the runtime exception continues to appear.

Can you advise me what to do? Is it a rule about how can a dll been transferred to a separate directory? Is it important this is a referenced dll or not .NET dll?

Thank you.
 

Raven65

Well-known member
Joined
Oct 4, 2006
Messages
305
Programming Experience
3-5
You may need to have the DLL in the system PATH.

The DLL has to be in a place that the system knows to look. If you were to move that DLL into Windows/System32 it should work fine because the system will look in that directory for it since its in the path.
 

olgage

New member
Joined
Nov 14, 2006
Messages
4
Programming Experience
Beginner
You may need to have the DLL in the system PATH.

The DLL has to be in a place that the system knows to look. If you were to move that DLL into Windows/System32 it should work fine because the system will look in that directory for it since its in the path.

It's a dll that is specific to my application. I would install my application on many other computers. Should I put my specific dll to the general WINDOWS directory and/or insert it to the Path?
 

Raven65

Well-known member
Joined
Oct 4, 2006
Messages
305
Programming Experience
3-5
From what you are describing as the problem, adding it to a folder in the PATH should fix the error. (For instance C:\Windows\System32\ or C:\Windows\System\ )
 

kracor

New member
Joined
Dec 14, 2006
Messages
1
Programming Experience
Beginner
This thread is also of very high interest to me. I am trying to teach myself VB.NET and am currently trying to build an .exe from my code. It's a simple little Windows form app that uses a C# .dll that I found. During the creation and testing of the program code in the IDE, the program performed flawlessly. As soon as I used build to compile it into an executable and run the program, the portion of the code that uses the .dll crashes with an error that part of the directory cannot be found. What the code is doing is concatinating the path of the project to a file name I specify. It should not do this. All of my variables show the correct information in the watches. Once I created that build, just like the original creator of this thread, each time the software is run in the IDE I get the same error about the directory. I'm thinking that I may have added the .dll incorrectly, but I haven't enough experience with building applications to know whether I did it correctly or not. Any suggestions on how to determine what went wrong?

P.S. Moving the .dll to the System32 folder made no difference.
 
Last edited:

Inhua

Active member
Joined
Dec 13, 2006
Messages
30
Location
JKT ID
Programming Experience
5-10
You are right Raven65. Since it is not .NET assembly, you cannot use the configuration file to allow the application knowing its required dll. The PATH parameter must include the complete folder name so the application knows where to search.

Thank's,
Inhua
 
Top Bottom