Last week I was spending some time comparing Fluent NHibernate with the new code mapping feature in NHibernate 3.2.
However, no matter what I tried, I always got the same error message. The error was happening in the CreateSessionFactory method and returned the following information:
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
Could not compile the mapping document: (XmlDocument)
persistent class FluentNHibernate.Model.Product, FluentNHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found
Could not load file or assembly 'FluentNHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
After losing almost all my hair, I finally discovered what caused the problem. I had named the project FluentNHibernate and that was causing the mapping to fail. Renaming the assembly to something else fixed it.
Stupid mistake…