开发者

How do I solve 'The specified module could not be found' while the .dll is in the application directory already?

开发者 https://www.devze.com 2023-01-16 01:57 出处:网络
I developed a winforms application in C# 4.0 that uses a .dll to communicate with a USB device. From Visual Studio 2010开发者_如何学JAVA this application works without problem. The referenced .dll is

I developed a winforms application in C# 4.0 that uses a .dll to communicate with a USB device. From Visual Studio 2010开发者_如何学JAVA this application works without problem. The referenced .dll is copied to the bin folder.

When I tried to run the application directly on the target machine it didn't do anything. I've added an unhandled exception handler to the application that logs the messages. When run locally on the target machine it doesn't log anything.

When I put the application on a network folder and run it (over the network) from my development p.c. it still works fine, but from my target p.c. it now logs "Could not load file or assembly 'sub20dnc.dll' or one of its dependencies. The specified module could not be found."

But as I said, the .dll is copied to the bin folder: sub20dnc.dll is in the same directory as the executable. sub20dnc.dll is part of an installation already done on the p.c. so it's dependencies should have been met. I'm trying to solve this error fist before tackling why nothing at all happens on the target machine locally.

Any ideas of how to solve this?

Thanks!


Sounds like they're missing a dependency on their machine rather than your .dll not being there. That is, a dependency of the .dll in question that "can't be found." That's the error I always see when something else isn't of a more later vintage.

Try running Depends.exe on their machine, checking against the .dlls your machine has. Also, may I suggest plugging the software into a test machine that has the most basic target machine configuration that you're attempting to work. That is, not on the latest and greatest updates.


Try Back to Basics: Using Fusion Log Viewer to Debug Obscure Loader Errors.


This is an old question, but I have the solution for this specific DLL.

sub20dnc.dll (or sub20dnc_v4.dll, the .NET 4 version) is a .NET wrapper around sub20.dll, which the SUB-20 driver installs to Windows\System32 and Windows\SysWOW64. When you run the program on your development machine, sub20dnc.dll loads sub20.dll from one of those two directories.

You can either install the SUB-20 driver on your target machine, or bundle sub20.dll with your application in addition to sub20dnc.dll. If you opt to bundle sub20.dll, make sure you grab the correct sub20.dll version for your application's target platform from your development machine. (These locations are correct only if using a 64-bit program to copy the file!)

  • 32-bit sub20.dll: Windows\SysWOW64\sub20.dll
  • 64-bit sub20.dll: Windows\System32\sub20.dll
0

精彩评论

暂无评论...
验证码 换一张
取 消