Tim
Tim

Reputation: 8921

mismatch assembly definition error after dll renaming on IIS server

I made some enhancements to the web site in Visual Studio 2012 and rebuilt the project. Up on the IIS server, I renamed the original dll to fooOLD.dll and copied up the newer version, foo.dll.

But now when I try to run the main page, there's an error:

Could not load file or assembly 'fooOLD' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have tried stopping and starting the IIS server, to no avail.

Apparently, IIS noticed my renaming of the file and has "remembered" it somewhere. How do I tell IIS that I'm trying to replace the old dll with a newer version?

Upvotes: 2

Views: 1586

Answers (2)

CodeCaster
CodeCaster

Reputation: 151594

You need to remove the old DLL from the bin directory.

If you don't, you have two assemblies in that directory with the same AssemblyName:

The runtime does not consider the file name when determining an assembly's identity. The assembly identity, which consists of the assembly name, version, culture, and strong name, must be clear to the runtime.

Now apparently the wrong one is loaded first, causing the error to be thrown, because the loading assembly (your site) is compiled against a newer version of the referenced assembly.

Upvotes: 4

Pankaj Kapare
Pankaj Kapare

Reputation: 7802

  1. Do iisreset
  2. Go to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files or C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files Note: Select path based on framework version you are using.
  3. Delete folder named after your application.

IIS will use newly copied file.

Upvotes: 3

Related Questions