문제

I have been trying to find a version of Sharp Architecture which works with Visual Studio 2008 and uses NHibernate 3 but have been unsucsessful. I want to use the QueryOver API from NHibernate version 3. The latest build available that I can find is sharp-architecture-1.6.0.0-templify-package.zip which is compatibale with Visual Studio 2008, MVC 2 and NHibernate 2. All the newer version of Sharp Architecture are only compatible with Visual Studio 2010. I attempted to make a custom build of Sharp Architecture:

I changed the references in the "SharpArchitecture 1.6 Full Source" project...:

  • NHibernate.Validator to Version 1.3.0.4000
  • NHibernate to Version 3.1.0.4000
  • NHibernate.ByteCode.Castle to Version 3.1.0.4000
  • FluentNHibernate to Version 1.2.0.694
  • Castle.Core to Version=2.5.2.0

...by replacing the old dlls with the new ones in the projects bin directory. Then I ran ClickToBuild.bat (located in the downloaded Sharp Architecture zip file base directory) to build the solution. The build succeeded and all the tests passed. Then I replaced the all dlls in my own project with the new Sharp Architecture ones I just built. My project does compile, but when I run it, SharpArch.Data\NHibernate\NHibernateSession.cs throws the following exception:

Could not load file or assembly 'Castle.Core, Version=2.5.1.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)

I tried using a bindingRedirect for Castle.Core in my web.config:

<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral"/>
                <bindingRedirect oldVersion="2.5.1.0" newVersion="2.5.2.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

but that still did not work.

Am I on the right track? What else can I do to get it to work?

도움이 되었습니까?

해결책

I've done that. You just have to change the references in the S# projects as there's no breaking change from NH 2.1 to 3.0 (or 3.1 if you want the most recent one) regarding S#.

It'll be a little bit cumbersome thus, but definitelly manageable.

note: Don't forget that projects like Fluent NHibernate should also be updated to use NH 3.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top