I'm extremely new to NHibernate so I apologize if I missing something trivial here. I am currently working through a book titled "NHibernate 3 Beginners Guide" from packtpub. I have mostly been following the directions in the book. When I say mostly I have diverged by using MySQL instead of MSSQL and have been using NuGet rather than downloading the binaries by hand.
I am in Chapter 2 at the moment which is the first real coding chapter. In this chapter I am building a simple WPF application to build my database schema through a button click. I have already built some POCO's for the Product
and Category
classes specified in the chapter. Through NuGet I have added the following references:
- MySQL.Data
- NHibernate (as a dependency automatically resolved, Iesi.Collections)
- Fluent NHibernate
When I click the button to build my database the following code block is executed:
private const string connString = "string omitted for brevity";
private void btnCreateDatabase_Click(object sender, RoutedEventArgs e)
{
Fluently.Configure().Database(MySQLConfiguration.Standard.ConnectionString(connString))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<ProductMap>())
.ExposeConfiguration(CreateSchema)
.BuildConfiguration();
}
Upon clicking the button I receive the following exception (FileLoadException
):
Outer Exception Message: Could not load file or assembly 'Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Inner Exceptions Message: Could not load file or assembly 'Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Here is the "Fusion Log" if that helps:
=== Pre-bind state information ===
LOG: User = Borealis\Frito
LOG: DisplayName = Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///C:/Users/Frito/documents/visual studio 2010/Projects/NH3BeginnersGuide/Chapter2/App/Sample.UI/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Frito\documents\visual studio 2010\Projects\NH3BeginnersGuide\Chapter2\App\Sample.UI\bin\Debug\Sample.UI.vshost.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.1.0 redirected to 4.0.0.0.
LOG: Post-policy reference: Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Users/Frito/documents/visual studio 2010/Projects/NH3BeginnersGuide/Chapter2/App/Sample.UI/bin/Debug/Iesi.Collections.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
I have tried the following and now am at a bit of a loss:
- Attempted upgrading Iesi.Collections through NuGet but that fails saying there isn't a version for NHibernate that is compatible.
- Downloading the binaries for NHibernate and FluentNhibernate and manually referenced them.
- Pulling the source samples from the book and copying over the DLLs in the sample. This gave me a different error that I haven't researched far enough to ask questions yet.
I have two questions:
- First, why would the NuGet packages attempt to look for a version 4.* dll when the versions that ship point back to 1.*?
- What other things should I try to get working short of getting all the source and building locally? I'm at a bit of a loss and would love some other input.
Thanks in advance!