Monday, 22 March 2010

Using (Fluent) NHibernate with VS2010 and unit test deployment turned on.

If you get an error from the system looking for the NHibernate.ByteCode.Castle and don't seem to be able to work out how to get VS to add the missing dll try the following...


    [TestClass]
    public class DatabaseInitialise
    {


        [TestMethod]
        [TestCategory("Database")]
        public void Initialize()
        {
            // Deleted details not relating to this post.


            var dummyValue = new NHibernate.ByteCode.Castle.ProxyFactory();
        }


    }

This makes the compiler believe that the dll is actually used in the test project and therefore copies it over.

If you have a better way of doing this please feel free to let me know!

No comments: