Monday, 3 October 2011

Mixed mode assembly is built against version ‘v2.0.50727′. Build error using NAnt.

I upgraded NHibernate from version 3.1.0 to 3.2.0 and had no problems with building my ASP.NET MVC 3 solution in Visual Studio 2010. I tried building using a NAnt script which has an additional task to run the Unit Tests in the solution and got the following error when using System.Data.SQLite.dll to run in-momery integration/smoke tests:

Could not create the driver from NHibernate.Driver.SQLite20Driver

After some googling, it turns out it had something to do with this error;

Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

Based on advice from the link: http://salvoz.com/blog/2011/01/07/mixed-mode-assembly-is-built-against-version-v2-0-50727-error-on-tfs-build-server/

I added the following to the nunit config file specifically "nunit-console-x86.exe.config";

<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime version="v4.0.30319" safemode="true" />
<supportedRuntime version="v4.0"/>


That did it for me.


No comments:

Post a Comment