Deploying VB.NET program can't find dlls in same folder

Go To StackoverFlow.com

1

I wrote a program in VB.NET which uses several .dlls that I programed in c++. The dlls wrap some functions from an old version of the program. On my development computer everything works fine but I build a release version, copy it and the dlls onto the target machine and the .exe starts up fine. When the program tries to use a function from the .dll it throws an exception and says "unable to load DLL "c:/the path/my.dll" the specified module can't be found."

I don't know if it makes any difference, but I am defining the dll functions in the main vb project using:

Declare Function MyFunction Lib "c:/the path/my.dll" (ByVal in1 as Double, ByRef out1 as Double) as Integer

I have checked the .net framework on the target and version 4 seems to be installed same as the development computer. Both are windows XP machines. I have no idea if it is the way I programmed the .dlls or just something with my vb.net project. Any help is appreciated.

2012-04-05 21:43
by user962342


3

Use a path relative to your executable, rather than an absolute path.

Or, even better, don't use the path at all and just list the name of the dll file. Then add the dlls as resources to your project. You should then be able to easily bundle the inside your setup project and they'll automatically end up in the right place for both debugging and deployment.

2012-04-05 21:46
by Joel Coehoorn
If you mean MyFunction Lib "my.dll" , I tried that and it doesn't work - user962342 2012-04-05 23:38
I added the dlls as resources and used a relative path, but got the same result - user962342 2012-04-06 15:54


1

If I am not mistaken, you want your application to function with all the .dll files you used and worked on your machine. The simplest thing to do is to publish your Program or application. But first, you have to follow the following steps in order to include all the .dll files that you want your published program to use.

  1. Click the Project tab and select the Add References… menu.
  2. from the opened new window, use the Browse… tab to locate the files you want to add to your project, then click Add.
  3. Then from the project menu, select your project property: for example, if your project is named Johns_App, then in the project tab, you will find Johns_App Properties. Click this, and it will take you to a new window.
  4. In this new window, click the Publish tab, then from the Application Files… tab, you can check, include, and exclude the project files. Then you are all set.
  5. I suggest using the Publish Wizard…, as it will guide you step by step.

Hope this helps

2018-08-30 21:18
by user10297372


0

Found a link to a CodeProject page which referenced this same problem.

Basically you need to check that all dependencies of the DLL file(s) are available in the running location. Using the Microsoft Dependency Walker led me to the solution that one of the dll files used in my VB application was referencing a different dll file. After placing that other DLL with other run files no more error!

2015-10-16 16:11
by sonyisda1
Ads