Archived Forum Post

Index of archived forum posts

Question:

Chilkat .NET assembly and "Any CPU"

Apr 07 '14 at 11:00

I have an issue with the components installing my application in our 2012 windows server. The only way I managed to use the email component was when I compile the application in Target cpu X86 mode, but I want the application in X64 or AnyCpu mode.

I have installed the ChilkatDotNet45.dll to the GAC (both 32 and 64 bit versions) but no luck. I have found several posts in the internet but the only thing that solves my problem is if I set all the project to X86 target cpu

What can I do to avoid these issues? My application consists of 3 projects that reference ChilkatDotNet45.dll. the version I have is 9.4.1.0 What I want is to use the x64 bit version no matter what...


Answer

Here are some bits of information that may help you to understand/resolve the problem:

  1. The Chilkat .NET assembly is a mixed-mode assembly, meaning that it contains native code. Therefore, the Chilkat DLL must be either x86 or x64. (Chilkat provides both of course.)
  2. The Chilkat assembly will work with an app built for "Any CPU" as long as the app's address space equals the Chilkat DLL's address space (32-bit or 64-bit).
  3. In C# and VB.NET application properties (in Visual Studio) there is a "prefer 32-bit" checkbox. An "Any CPU" application will run as a 32-bit process (i.e. 32-bit address space) if this is checked. In this case you would need to use the 32-bit Chilkat assembly.
  4. Otherwise, an "Any CPU" app will have an address space that matches the address space of the operating system (32-bit or 64-bit). You must use the Chilkat assembly that matches.
  5. You may install the Chilkat assembly in the GAC, but make sure the 32-bit Chilkat assembly is installed into the 32-bit GAC, and the 64-bit assembly is installed in the 64-bit GAC.
  6. Your app may specifically target x86 or x64, and in that case you would choose the matching Chilkat assembly.
  7. You can only "use the x64 no matter what" if all computers on which you need to run are indeed 64-bit. Obviously, you cannot run a 64-bit app on 32-bit Windows.