It is possible that if you are working on a .NET Framework console project, that you may encounter the following error when using Kameleo’s Local API Client with Selenium:
System.BadImageFormatException
HResult=0x8007000B
Message=Could not load file or assembly 'Kameleo.LocalApiClient, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=KameleoTest
Cause: This error occurs because there is a mismatch between the processor architecture of the project and Kameleo’s API library. The project is targeting 32-bit (x86) execution, while the Kameleo Local API Client requires a 64-bit (x64) environment.
Solution: To resolve this issue, adjust your Visual Studio project settings to ensure compatibility with Kameleo’s API library as shown on the image below:
Option 1: Change the Platform Target to x64
-
Right-click on your project in Solution Explorer.
-
Select Properties.
-
Navigate to the Build tab.
-
Change Platform target to x64.
-
Save the changes and rebuild the project.
(This will remove the warning and ensure full compatibility.)
Option 2: Untick "Prefer 32-bit" (If Using "Any CPU")
-
Right-click on your project in Solution Explorer.
-
Select Properties.
-
Navigate to the Build tab.
-
If the Platform target is set to Any CPU, uncheck the Prefer 32-bit option.
-
Save the changes and rebuild the project.
(This will keep the warning but allow the program to run correctly.)
Visual Preferences:
- Launch
Kameleo.CLI.exe
from each folder - Log in with different email addresses (one license per instance)
By ensuring your project is configured to run in a 64-bit environment, you can successfully use Kameleo’s API with Selenium without encountering System.BadImageFormatException
errors. If you continue to experience issues, please reach out to our support team for further assistance.
- Prefer32Bit.png20 KB