Archived Forum Post

Index of archived forum posts

Question:

How to fix processor mismatch error

Jan 15 '16 at 09:09

Hello, I am using Win 7 Home x32, vs2012 and in my project properties under BUILD tab target platform is set to Any CPU and also using ChilkatDotNet4.dll for 32bit when I am compiling the project it is giving me this below warning but i am unable to execute the app.

When I change the target platform to x86 it works fine can somebody tell me why it is happening because I want to keep target platform as Any CPU.

Warning 1 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ChilkatDotNet4", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. WindowsFormsApplication1

Thanks


Accepted Answer

It's only a warning that means when you deploy your app, you must be sure that the 32-bit Chilkat assembly is loaded when your application runs as a 32-bit process (which is always the case on a 32-bit machine, and would be the case for 64-bit machines if you explicitly target 32-bit). If your application runs as a 64-bit process, you must be sure that the 64-bit Chilkat assembly is loaded at runtime. Otherwise you'd get the "incorrect format" error.

The Chilkat .NET assembly is a mixed-mode assembly. Because it's written in C++, the inner-core compiles to native code. The outer layer is managed. Therefore, the assembly itself cannot be "Any CPU".

Two possible choices are:

1) Target your app for 32-bit, which allows you to use the 32-bit assembly on any type of system.

or

2) Target your app for "Any CPU". In this case you'll need to deploy the Chilkat assembly that matches the computer architecture. You don't need separate builds of your app, just copy the correct Chilkat DLL with the app.

Also see this: http://www.chilkatforum.com/questions/1248/utilizing-32-and-64-bit-any-cpu-builds-in-vbnet

Also, in the coming months, Chilkat will be releasing a download for Mono to support .NET cross-platform. This implementation will provide a pure / managed .NET assembly, which can be reference by an app w/ "Any CPU" as the targeted architecture. However, it will also come with a "functional" DLL/shared-lib (meaning function-based instead of object-oriented class-based) that would need to be distributed alongside the Chilkat Mono assembly. (Which by the way, the functional DLL could be used by C/C++ programs, or programs in other programming languages. For example, just like Win32 Platform SDK functions are callable from VB6.) The Chilkat Mono implementation would provide a single API for platforms including MAC OS X, Linux, Windows, Android, and iOS. That is the current goal.


Answer

Thanks alot for the prompt support.


Answer

When you will release download for Mono to support .NET cross-platform? Approx release date?


Answer

Also see this: http://www.chilkatforum.com/questions/9610/dynamically-loading-a-32-bit-or-64-bit-net-assembly-at-runtime