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

Published 06-28-2007 6:14 PM | jokiz

I was running a test today which uses NHibernate to load data from the database and I got this result.  The inner exception details are below:

Inner Exception
System.TypeInitializationException
Message: The type initializer for 'NHibernate.Cfg.Configuration' threw an exception.
Source: NHibernate
StackTrace:
at NHibernate.Cfg.Configuration..ctor()
Inner Exception
System.IO.FileLoadException
Message: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source: NHibernate
StackTrace:
at NHibernate.Cfg.Configuration..cctor()

If you're not familiar with the loader (fusion), ask Suzanne Cook, she's the person to ask.  Or even read Richard Grime's fusion workshop.  If you're not familiar with .NET assemblies and manifests, ask Andrew Troelsen, check out his C# and the .NET Platform book.

Anyway, turned out that the cause was when I upgraded the log4net assembly from 1.2.9 to 1.2.10.  You can see from the manifest of NHibernate.dll

.assembly extern log4net
{
  .publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00...
  .hash = (06 F1 94 5F 4B C8 66 DB CD 0F AE 55 77 2C 9F 23...
  .ver 1:2:9:0
}

that log4net.dll was referenced as a shared assembly with specific version 1.2.9.  So the loader couldn't load the assembly with the specific version since I have overwritten it. 

The reason I upgraded log4net is because I want the string.Format support for logging where I can do log.ErrorFormat("Error while saving Customer ID: {0}", customer.ID) constructs. 

Two choices now, upgrade to NHibernate 1.2 or downgrade log4net to 1.2.9.

Filed under: , ,

Comments

# Lipitor cause vertigo. said on March 26, 2009 11:50 PM:

Lipitor.