none
Urgent! Unable to load DLL. The specified module could not be found.

    Question

  • I have an application that is built in VB.NET, Visual Studio 2005 and am using ClickOnce to publish and deploy my application.  There is a part of my application that requires the use of 3rd party DLL's and I therefore have them included in my application.  NOTE: They are NOT added as references but are added as files to my Visual Studio Solution or in other words are in the same place as all my forms etc.  These files are copied to the installation output directory which should be all it takes to work.

    So, now, when I go to install this application on a computer I get mixed results.  I have two "development" machines that I install this application on and everything works fine.  However, I have tried installing it on two "non-development" machines and when I get to the point where my application needs to reference the stated DLL file I get an unhandled exception message stating.....

    Unable to load DLL 'dssce'.  The specified module could not be found.

    I cant figure out why this is working on two computers but isnt working on the others.  I have verified that the DLL files are in fact copied to the ClickOnce installation directories. Why is the application unable to load this particular DLL?

    Thanks!

    Mike
    Friday, April 13, 2007 6:32 PM

Answers

  • The 3rd party DLL probably requires one or more support DLLs, either installed in the GAC or stored in a folder like c:\windows\system32, that are not available on the non-development PC.  Either pre-install the 3rd party software or find out what DLLs it needs by using DependencyWalker.
    Friday, April 13, 2007 6:58 PM
    Moderator
  • It is probably a good idea to play with DependencyWalker for a while.  It is a powerful tool but it takes time to learn the power.  You can't simulate a button click with "Program arguments".  Just click the button and see what happens in either case; the program is not going to load DLLs while it is idle...
    Friday, April 13, 2007 10:09 PM
    Moderator

All replies

  • The 3rd party DLL probably requires one or more support DLLs, either installed in the GAC or stored in a folder like c:\windows\system32, that are not available on the non-development PC.  Either pre-install the 3rd party software or find out what DLLs it needs by using DependencyWalker.
    Friday, April 13, 2007 6:58 PM
    Moderator
  • Thanks so much for your reply.  After I read this I was really hopeful this could be the answer. So I used that Dependency walker tool you suggested and it listed all the dependencies of the .DLL in question.  So one by one, I searched for those .DLL on the machine that was not loading the .DLL in question (Note: I just searched the uppermost "tree", It would take me all day to do all the sub Dll's). Unfortunatly,  I found every one of the on the computer that is having the problems.

     

    So, there really isnt a installation for the 3rd party software.  It is just .DLL files.  There are a couple of them and again, they are all copied to the directory that the application.exe file is in.  Normally, that shoud be it!  I have also tried copying these .DLL's to the \Windows and Windows\System32\ directories but that doesnt work either.  Do I have to do some DLLImport or something in my code?

     

    Thanks for your help!

     

    Mike

     

     

    Friday, April 13, 2007 8:36 PM
  • Make sure you use the Profile command in DependencyWalker.  A lot of DLLs get loaded at run time rather than statically.  You'll get a big list, the best way to do it is to run it on a PC that doesn't have the problem, save the log, run it on the problem PC, save that log and compare.
    Friday, April 13, 2007 8:56 PM
    Moderator
  •  

    Sounds like a great idea.  OK, so admitedly, this is a bit over my head but I think I can get there.  So quick question.  I have loaded the .exe and created a profile.  However, in my application, the Unable to Load DLL error only happens when the .dll is first called.  In this case, it is when a button.click event is fired.  Therefore, dont I need to somehow profile this action?  In other words, the initial loading of the application works fine and I dont know that this profile will provide the infomation regarding the error.  I see there is a Program Arguments field option.  Can this simulate this button click from here?

    Friday, April 13, 2007 9:36 PM
  • It is probably a good idea to play with DependencyWalker for a while.  It is a powerful tool but it takes time to learn the power.  You can't simulate a button click with "Program arguments".  Just click the button and see what happens in either case; the program is not going to load DLLs while it is idle...
    Friday, April 13, 2007 10:09 PM
    Moderator
  • Pretty old post but shows up high in Google so I am gonna post my solution to the issue: I was writing a minimal DLL in C++ which I integrated in a minimal C# console application and got the same error that you stated above. The final fix is simple: Your target PC might not have the appropriate VS redistributable package installed. In my case (VS 2013) it was this one here: http://www.microsoft.com/en-us/download/details.aspx?id=40784 for some reason it does not work to copy the required DLLs from the system32 folder manually... what a freak bug taking me half a day to find out. I did not find this anywhere online, will do some cross-posting now...
    Thursday, August 07, 2014 2:51 PM