I had a similar problem. I found out that the "NHibernate.ByteCode.Castle.dll" was not being copied to the Bin directory of the application, even when it's set to do so in Visual Studio.
I don't have the original link, but apparently it is a bug in visual studio.
What I ended up doing was to force it by having a static function a class as follows
Code:
internal class NHibernateRefenceBug
{
internal static void Fix()
{
Castle.DynamicProxy.DefaultProxyBuilder fix1 = new Castle.DynamicProxy.DefaultProxyBuilder();
NHibernate.ByteCode.Castle.ProxyFactoryFactory fix2 = new NHibernate.ByteCode.Castle.ProxyFactoryFactory();
}
}
and calling that function before doign anything related to NH Repository( i.e. before creating a singleton repository object ).
Hope this helps.