Archived Forum Post

Index of archived forum posts

Question:

Could not load file or assembly 'ChilkatDotNet4.dll' or one of its dependencies. is not a valid Win32 application

Jan 17 '13 at 03:40

We have a client's system on which we are getting error while loading the ChilkatDotNet4.dll. The issue is not only in our software which uses the reference of ChilkatDotNet4.dll(32 bit version), but even if I prepare a sample application by giving ChilkatDotNet4.dll as reference and deploy it on that one system, it gives following error: Could not load file or assembly 'ChilkatDotNet4.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Stack trace: System.BadImageFormatException: Could not load file or assembly 'ChilkatDotNet4.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) File name: 'ChilkatDotNet4.dll' at WindowsApplication4.Form1.Form1_Load(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

It works fine on other systems with same configuration at the same client. Note: Our application runs as 32 bit and hence we use the 32 bit version of ChilkatDotNet4.dll.

The pre-requisite for ChilkatDotNet4.dll are 'Microsoft Visual C++ 2010 x64 and x86 redistributable'. Is there any other pre-requisite which needs to be installed on the system for ChilkatDotNet4.dll or its dependencies to load? Please let us know what all we can troubleshoot.

Here are the client's system OS details: Windows edition: Windows 7 Professional SP1 System Type: 64-bit Operating System Processor: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz

More details on our application: It is compiled with .Net framework 4 and with x86 compilation - Windows application.

I have searched many forums but none of them are helping. Is there any solution for this? What is going missing?


Answer

This error is actually the "incorrect format" error. See http://www.chilkatforum.com/questions/114/64bit-could-not-load-file-or-assembly-chilkatdotnet4-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format


Answer

Hi,

For solution 1 and 2 mentioned in the link wont help as my app is running with target for x86 and is a Windows service. Also, I tried the third solution mentioned to install the ChilkatDotNet4.dll using GACUtil of 64 and 32 bit, ChilkatDotNet4.dll got installed in GAC_64 and GAC_32 folders respectively. I also manually created the following GAC entries: C:WindowsMicrosoft.NETassemblyGAC_MSILChilkatDotNet4v4.0_9.0.8.0__eb5fc1fc52ef09bdChilkatDotNet4.dll (using the 64bit version of the dll)

Restarted the system, but still getting the same error. What should be my next step?