views:

52

answers:

2

Hi, I am trying to upgrade my mvc 1 app to mvc 2. Previously I was using Castle Core 1.1.0 but had to get the latest version 2.5 to work with mvc 2. I now get the following error.

Could not load file or assembly 'Castle.Core, Version=2.5.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Is a reference to the old version causing this or could it be the fact that I have older versions of Castle Core in different projects within the same solution?

Any pointers much appreciated,

A: 

Sorted it by adding this to the web config.

<dependentAssembly>
    <assemblyIdentity name="Castle.Core"
                      publicKeyToken="407dd0808d44fbdc"
                      culture="neutral" />
    <bindingRedirect oldVersion="1.1.0.0"
                     newVersion="2.5.0.0"/>
  </dependentAssembly>
Chin
A: 

You need to recompile your application and whatever dependencies you have on Castle.Core (e.g. NHibernate.ByteCode.Castle.dll) against 2.5.

Other workarounds, like assembly redirection, are hacks and will likely fail at runtime when least expected.

Mauricio Scheffer

related questions