NHibernate 2.1 and Unit Testing with MSTest Using MSBuild
I have a MSBuild script that Cruise Control is using to do it’s build and run the unit tests. After updating to NHibernate 2.1 and using NHibernate.ByteCode.LinFu for the ProxyFactoryFactory, the unit tests started failing in the build script, but not in Visual Studio.
I checked the references of my test project, and NHibernate.ByteCode.LinFu.dll was referenced, but the assembly wasn’t being copied into the test folder when ran with the script. I opened the test assembly up with ildasm.exe and checked the manifest and the LinFu assembly wasn’t in there. It was being references in the project, but apparently since there is not code actually using the assembly, the reference isn’t built into the manifest.
The way I fixed this is, in the unit test class I added a deployment item for the assembly that I wanted copied.
[DeploymentItem( @"..\References\NHibernate\NHibernate.ByteCode.LinFu.dll" )]
This fixed the failing unit test. Life is good again.