Archive

Posts Tagged ‘Visual Studio 2010’

Running .Net 4 RC NUnits tests in TeamCity

March 16th, 2010 No comments

Today, we finally found a way to run NUnit tests in .Net 4 assemblies in TeamCity! Here’s the solution:

Problem with NUnit runner when using MSBuild 4.0

/Emil

NUnit with SQLite and .Net 4.0 Beta 2

November 20th, 2009 14 comments

SQLite and unit testing is a great combination for testing database operations without having to manage database files. You can simply create an in-memory database in your setup code and work with that instance. Perfect in combination with NHibernate, for example.

If you want to do this in the current .Net 4.0 beta you’re out of luck though, you’ll get an exception:

System.IO.FileLoadException: 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.

The solution is pointed out by Jomo Fisher. What you do is to include this snippet in the application config file:

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

When unit testing assemblies that references System.Data.SQLite.DLL then you have to put that snippet in NUnit’s config file (C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit.exe.config).

If you combine this with the tip in my post NUnit with Visual Studio 2010 Beta 2, you should insert the following

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

plus

<loadFromRemoteSources enabled="true" />

under the runtime tag.

This works for me, hopefully it will for you as well.

/Emil

NUnit with Visual Studio 2010 Beta 2

November 16th, 2009 1 comment

Here’s a tip of how to run NUnit tests in .Net 4 code:

Running NUnit 2.5 against Visual Studio 2010 .Net 4 code

Note that it’s the NUnit.exe.config file in C:\Program Files\NUnit 2.5.2\bin\net-2.0 that should be updated.

Web Analytics