1

I am having a similar issue as others with unmanaged c++ dll’s called from managed c# application however I have not been able to find a viable solution. I have included my 3rd party unmanaged dll’s in the project and Publish clickOnce included them in the same directory.
I compiled my c# project as 32 bit. The release build runs on my development system and other systems with visual studio 2012.

[DllImport(@"controller.DLL", CallingConvention = CallingConvention.Cdecl)]
public static extern int XR2_hexCmnd(int xr2Hex_command);

When run on other pc’s without visual studio 2012 I get the following error: System.DllNotFoundException: Unable to load DLL 'controller.DLL': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I get the same error using publish with clickOnce.

I have a demo version of InstallShield. When I run InstallShield it works on any PC’s. If I uninstall the program, clickOnce works (where it did not work before using installShield). When creating InstalShield installer it finds that there is a dependency of MSVCR110.dll (I included this dll in the project dir created with publish and it still does not work until InstallShield is run).

Dependency Walker does not seem to work for this project. It reports that there are many dll’s missing even on PC’s where it is working. I included all the missing dll’s and the application still does not work until using installShield.

Unfortunately InstallShield is not an option, as the application is to be incorporated into larger application.

gunr2171
  • 16,104
  • 25
  • 61
  • 88
  • Try [here](http://stackoverflow.com/questions/6173501/how-can-i-deploy-an-unmanaged-dll-with-a-wpf-click-once-application) and [here](http://stackoverflow.com/questions/10383971/publish-unmanaged-dll-from-referenced-project) – D Stanley Sep 24 '14 at 19:44
  • To fix the problem I added the x86 version of MSVCR110.dll (not one of my dll’s) to my application. There is probably a cleaner way to point to (or add) the correct MSVCR110.dll. There were several versions of the dll on my system. Adding the specific version of the dll placed the MSVCR110.dll with my other dll’s and application in the same folder and may have caused the application to first look in the application folder. Just adding the dll to the app folder did not work. I can only speculate that depends was using the 64 bit version of MSVCR110.dll and reported other dll’s missing. – Pat McLaughlin Oct 01 '14 at 15:04

0 Answers0