开发者

MVC 2 and castle ioc

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开发者_如何学Go in different projects within the same solution?

Any pointers much appreciated,


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.


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜