5
votes

I'm unable to run MSTest Tests with code coverage enabled while using NHibernate. I get the following error message:

Unit Test Adapter threw exception: Type is not resolved for member 'NHibernate.Cfg.HibernateConfigException,NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'..

Edit : Same thing happens when I turn on deployment (open local.testsettings under deployment enable deployment)

1
could it be resolving another version of NHibernate from the GAC? Check your GAC for NHibernate assemblies, delete them if you have any. - Mauricio Scheffer
@Mauricio Scheffer : nothing related to nhibernate is in the GAC - Hannoun Yassir

1 Answers

1
votes

Maybe old thread, but I just found the solution and wanted to share. Looks like the problem is in code coverage. When you enable code coverage, it puts assemblies in different folder than usual (probably). So it copies the assemblies but not xml or any other file type. In order to solve the problem, double click Local.testsettings file in Solution Items, select "Deployment" on the left side, click "Add File" and choose hibernate.cfg.xml or any other file you want to be copied to the output directory. The problem should be gone now.