"Could not load file or assembly 'ChilkatDotNet2, Version=18.104.22.168, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. An attempt was made to load a program with an incorrect format."
The “incorrect format” error is a 32-bit vs. 64-bit mismatch. It means the application is trying to load a 64-bit .NET assembly into a 32-bit process, or the reverse (a 32-bit assembly into a 64-bit process).
Possible solutions are:
1) Target your app for x86 instead of “Any CPU”. If you do this, then your application will run as a 32-bit process regardless of the machine architecture and you may always use the 32-bit Chilkat assembly.
2) If you really need to target “Any CPU”, then make sure to deploy the 32-bit Chilkat assembly w/ your app on 32-bit systems, and deploy the 64-bit Chilkat assembly to 64-bit systems.
3) If your app is running within ASP.NET or a Windows Service and you’re not quite sure whether it’s 32-bit or 64-bit, then install the 32-bit Chilkat assembly in the 32-bit GAC (Global Assembly Cache), and also install the 64-bit Chilkat assembly into the 64-bit GAC. The .NET runtime will automatically look in the correct GAC and will find the correct assembly.