lfaldanam / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

Mismatched Version Reference exceptions when using SharpArch dlls #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Copy the SharpArchitecture dlls to a lib folder of a new VS2008 project
2. Set up the project configuration files along the same lines as the
sample northwind project.
3. Add the references from the lib folder to the projects as required.

What is the expected output? What do you see instead?

Run the project - exceptions occur complaining that the there is a version
mismatch in the dlls, specifically for NHibernate 2.0.0.4000 and Ninject

NHibernate, Version=2.0.0.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference.

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

What version of the product are you using? On what operating system?

SharpArchitecture_0.9.72.zip, Visual Studio 2008, Windows XP

Please provide any additional information below.

Using Reflector on the .dlls verifies that the dlls included with
SharpArchitecture that reference NHibernate/Ninject do indeed reference
older versions of Ninject and NHibernate than the NHibernate and Ninject
dlls included.

What I can't figure out is how the Northwind sample project manages to run
given all of these version mismatches...

Original issue reported on code.google.com by davi...@yahoo.com on 14 Nov 2008 at 6:06

GoogleCodeExporter commented 9 years ago
Ok, so I figured it out.   

Needed to add the assemblyBinding redirect.  Perhaps that should be more clearly
documented in the Development Guidelines documentation?

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4"
culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535"
newVersion="2.0.1.4000"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Original comment by davi...@yahoo.com on 14 Nov 2008 at 6:49

GoogleCodeExporter commented 9 years ago
I've added this assembly redirect to the Visual Studio template to assist as 
well.

Original comment by wmccaffe...@gmail.com on 3 Dec 2008 at 3:53