Tuesday, February 22, 2011

How to use NUnit in Visual Studio 2010

To run NUnit, you need to add the following to the NUnit.exe.config file:

Under C:\Program Files\NUnit 2.5.9\bin\net-2.0\nunit.exe.config (replace version with whatever you have installed) add the following:

 <startup>
   <!-- the below is WRONG! See here for why.
      <requiredruntime version="v4.0.30319">
    -->
   <supportedruntime version="v4.0">
 </startup>

Also add the following in the <runtime> block:

<loadfromremotesources enabled="true">

The reason is that in .NET v3.5 and below, remote assemblies were loaded partially trusted. Starting with .NET v4, unless you add this directive then you will get a runtime exception.

Once you have done this, add another dll project and add a reference to NUnit.Framework.

2 comments:

  1. You DESERVE DEATH for your 'opinion' here
    http://anarchish.blogspot.com/2011/02/5-reasons-left-should-support-labour.html#comments

    ReplyDelete
  2. Yeah, that's right. I "deserve death" for telling pie-man that he is a moron for throwing a shaving cream pie at Murdoch senior, thereby removing focus on the REALLY BAD SHIT that Murdoch has done.

    Great strategy!

    ReplyDelete