AutoIt (AutoItX) in C # Windows 7 App System.DllNotFoundException

I have a C # application that uses AutoItX for automation. This application works fine in my Windows 8.1 x64 environment compiled with the release of Microsoft Visual Studio 2013 3.

I copied a copy of the application code to the bitbucket repository and cloned it to a computer running Windows 7 x64. AutoItX 3.14.2 was installed and 32-bit calls were selected. The application was compiled using Visual Studio 2013 4 release .

The application compiled fine, but the first use of AutoIt functions resulted in an error:

An unhandled exception of type 'System.DllNotFoundException' occurred in AutoItX3.Assembly.dll

I have tried the following steps. The app has been tested after each of these steps.

  • Trying to register .dll manually with regsrv32

    regsrv32 "C: \ Program Files (x86) \ AutoIt3 \ AutoItX \ AutoItX3.dll"

  • Remote VisualStudio 2013 R4 and tried to reinstall VisualStudio 2013 R3 {Installation of R3 failed because Internet Explorer version 10 and version 11 were installed on this computer}, so R4 was reinstalled

  • Removed AutoIt and reinstalled by selecting the 64-bit library. Compiled application with x64 platform option

  • Removed AutoIt and reinstalled using 32-bit library preferences Compiled application with X86 Platform option

  • AutoItX3.dll manually copied to the directory C: \ windows \ System32

  • Manual copy of AutoItX3_x64.dll to the c: \ Windows \ SysWOW64 directory. Compiled an application for the x64 platform

  • A cleaned computer will clean and reinstall Windows 7, AutoIt (32-bit preference), Visual Studio 2013 R4

  • Installed AutoIt v14

  • ​​- AutoIt v15

  • Windows - 213 (!)

  • Internet Explorer v11

  • Windows - 4

  • AutoIt 3.10.2, Windows 8

, . , , - ,

+4
3
  1. AutoItX3.dll C:\windows\System32

  2. AutoItX3_x64.dll c:\Windows\SysWOW64. x64

, , . DLL , AutoItX3.dll AutoItX3_x64.dll , Windows. DLL, . - Dumpbin.exe/import.

.NET, [DllImport]. AutoItX3.Assembly.dll , ILSpy Reflector. , DLL . AutoItX3.dll 32- AutoIt_x64.dll 64- .

btw, ab/ - DLL. , , - Windows.

Windows, 16- ( 1 3.11), c:\windows\system . NT 3.11 Windows 95, 32- , c:\windows\system32. 64- , Microsoft c:\windows\system64. . , , .

64- , 32- , WOW64. "Windows 64- Windows". c:\windows\syswow64 32- .

, . .


:

  • DLL - . , .
  • Dependency Walker . .NET, , AutoItX3.dll. - , .
  • Process Monitor DLL. , DLL, , , . , . , , , ~ Win81, - , , , . YMMV.
+1

DLL . Dependency Walker, Process Monitor.

32/64 , BadImageFormatException.

DLL- :

0

AutoItX3.dll /bin/Debug /bin/Release.

What you can do is add Post-build events to the command line:

copy /Y "$(SolutionDir)\packages\AutoItX.3.3.12.0\AutoItX3.dll" "$(ProjectDir)\bin\Debug" 

 

copy /Y "$(SolutionDir)\packages\AutoItX.3.3.12.0\AutoItX3.dll" "$(ProjectDir)\bin\Release"

enter image description here

0
source

Source: https://habr.com/ru/post/1610059/


All Articles