Could not load file or assembly ‘ChilkatDotNet4.dll’ or one of its dependencies.

(Thank you Josh for your helpful information!)

“I see that occasionally information from clients (with the client’s permission) end up on the blog and thought that perhaps this one would qualify. If there is mention of the C++ Runtime, I didn’t find it.

At any rate, I was having trouble getting the ChilkatDotNet4.dll to load. After a conversation with Matt, I tried installing the Microsoft Visual C++ 2010 Redistributable Package – this resolved my issue:

x86 Microsoft Visual C++ 2010 Redistributable Package
x64 Microsoft Visual C++ 2010 Redistributable Package

I’ve included the error messages below to illustrate that the .dll appears to be being found when registered to the GAC (and certainly when placed directly in the web site’s bin), but cannot load its dependencies.

When loaded into GAC but not found (or when in bin):

Could not load file or assembly ‘ChilkatDotNet4.dll’ or one of its dependencies. The specified module could not be found.

When not loaded into GAC and not in bin:

Could not load file or assembly ‘ChilkatDotNet4, Version=9.0.8.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd’ or one of its dependencies. The system cannot find the file specified.”

The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Question:
We want to use the 64-bit version of the Chilkat email functionality, but we get a could not load error message (see below for full error) when i use the v8.5.0 release of the Chilkat library. This also happens when i use the 32-bit version. Is it possible that the license key is linked to a specific version of the Chilkat library in our case version 8.2.2.0?

If so how can we upgrade to 8.5.0, because we need to be able to install our software on a 64-bit machine.

Could not load file or assembly ‘ChilkatDotNet2, Version=8.2.2.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Answer:
The .NET runtime requires that the assembly version matches exactly. The version of the assembly used in your Visual Studio project (i.e. on your development machine) must match the version deployed to your production system. The platform may be different: win32 vs. x64, but the version must match. The solution is to use Chilkat v8.5.0 in your Visual Studio development environment. New-version upgrades are always free, so you may download the latest at Chilkat Software Component Downloads

Using Assembly in ASP.NET – Simplest Example

This example demonstrates the simplest method for using a .NET assembly in an ASP.NET web page.

1) Create a new file “helloWorld.aspx” in your web site’s root directory. Using a text editor, add this:

<%@ Page Language="C#" %>
<%@ Import Namespace="Chilkat" %>

<html>
<head>
<title>ASP.NET Hello World</title>
</head>
<body bgcolor="#FFFFFF">

<p>
<%
	Chilkat.Ftp2 ftp = new Chilkat.Ftp2();
	Response.Write(ftp.Version);
%>
</p>

</body>
</html>

2) Create a “bin” directory in the same directory where the helloWorld.aspx file is located.

3) Copy the managed assembly (in this case it is ChilkatDotNet2.dll) into the “bin” directory.

4) That’s it. Browse to http://www.yourwebsite.com/helloWorld.aspx. The time to load the first page hit will be significantly longer than subsequent page loads. Errors are most likely permission related. Feel free to send error listings to support@chilkatsoft.com