tags:

views:

95

answers:

2

Hi All,

I developed a winforms application in C# 4.0 that uses a .dll to communicate with a USB device. From Visual Studio 2010 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!

+1  A: 

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

Sean Fausett
Ah thanks. Sorry I wasn't clear enough. When I run the .exe directly on my development p.c. it runs fine.It's only when I try to run it on the target machine (over the network) with .Net Framework and the usb installation done locally that I get the error message. I can't run Fusion on the client, it doesn't start up.If I try to run the application on the target computer (not over the network) I don't even get the error log.
Stefan
From my development p.c. either locally or over the network Fusion shows the .dll in the application directory is being loaded.
Stefan
If you can't run Fusion directly / locally on the client machine then something must be amiss with that machine's configuration. As wheaties said, try using Depends.exe (http://www.dependencywalker.com/) to validate your native dependencies, including on FusLogVw.exe itself.
Sean Fausett
Ah, thanks Sean, I hadn't thought of checking FusLogVW.exe itself!!
Stefan
OK, so I ran a profile of FusLogVW.exe in Depends, both on the development pc and the target pc. They show exactly the same log with three errors for MSCOREEI.dll (specified procedure could not be found). This doesn't seem to be the problem however since Fusion runs normally on the development PC. But even though the logs are exactly the same, on the development pc I get the Fusion UI and have to manually close the app, but on the target pc I never see the UI and it closes by itself. Both exit with code 0 in Depends. I'm getting more confused by the minute... :-)
Stefan
+2  A: 

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.

wheaties
Thanks! Depends gives me the same warnings for the same dll's on both machines: IESHIMS.DLL (error opening file. the system cannot find the file specified(2)), IEFRAME.DLL (just a red icon without a warning), SHLWAPI.DLL (just a red icon without a warning). These dlls seem to be from Internet Explorer? Not using that at all... Also with the same warnings, I don't understand why one would work and the other wouldn't.
Stefan
Using depends on the application didn't tell me anything (I expected it would tell me about dependencies of dependencies as well, but apparently not), but when I ran depends on the dll it came up with a missing dependency on msvcr100.dll. This is part of the .Net framework apparently, but was missing even though the .Net 4.0 verifying tool said .Net was installed correctly. I had to copy the msvcr100.dll from my development pc to the target pc's Windows\System32 directory and the application starts now. No clue what this .dll does, but there you go. Thanks!
Stefan
Check to make sure you're allowed to redistribute a .dll first. More than likely you'll be able to trace it to a redistributable that you can install along with your application.
wheaties
Sean Fausett
Ah thanks Sean. Good to know!
Stefan