DllImport throws a System.DllNotFoundException

I'm having some difficulties trying to use unmanaged code dllfrom my application (written in C # framework 4.0). Im using import dllas follows

[DllImport(@"C:\MGW_SDK.dll", EntryPoint = "fInicializaSDK")]
public static extern int fInicializaSDK();

It is strange that when it is called from my development environment (Windows XP), it works fine, but the following exception is thrown on the production server (Windows7):

System.DllNotFoundException: unable to load DLL ' C:\MGW_SDK.dll': the specified module was not found. (Exception from HRESULT: 0x8007007E) in Comtpaq.AdminPack.SDKWrapper.fInicializaSDK()in Comtpaq.AdminPack.AdminPaqRepository.InitializeSDK()in C:\Work\AgroIn\AdminPaqRepository.cs: line 30

I already ran Dependency Walker , which shows the following dependency as conflicting:C:\windows\system32\SHLWAPI.DLL

I already tried to copy this dllto my deployment directory

MGW_SDK.dll c:\ ( )

C Runtime Library

: C:\Work\AgroIn\AdminPaqRepository.cs:line 30

?

extern/dllimport, MGW_SDK.dll, ( DllNotFoundException), , -, , ( WCF). WAS, .

+5
4

, . dll dll. , DllImport. .

, DLL. . ( Wayback).


Oracle 9.2 Client , Oracle Home, :

  • Windows .

  • Windows "" ORACLE_HOME. "Ora92" "Oracle" (.. D:\Oracle\Ora92).

  • ORACLE_HOME "" . "" .

  • "" "" .

  • " " "" ( Windows XP "" " " ).

  • " " "" "" ( Windows XP "" " " ).

  • " " "" ( , ).

  • "", " " , " ", ,

      Permission = Read & Execute 
      Apply To = This folder, subfolders and files 
    

    , , " " " , ". , .

  • "", . , , .

  • , , ().

, .

+6

C , UAC . , , - DLL . DLL ( C, - Program Files) , . , () , .

+2

?

Assembly Binding Log Viewer

+1

, , MGW_SDK.DLL regsrv32 Win7?

Also try to find out if dependencies on MGW_SDK.DLL are available on the Win7 computer (it will work either in the system or in the folder of your application)

+1
source

All Articles