NUnit and Visual Studio 2005 Beta 2

I was struggling to get NUnit 2.2 to work with a VS2005 Beta 2 project. I kept getting a BadImageFormatException when I tried to launch NUnit-GUI.exe.

The solution was to add the following line to the <startup> tag of nunit-gui.exe.config (and nunit-console.exe.config if you are using it from the command line):

<supportedRuntime version=”v2.0.50215” />

EDIT: For the final release of Visual Studio 2005 you would of course use:

<supportedRuntime version=”v2.0.50727” />

You may need to comment out all the other supportedRuntime entries to get it to work.

Having got NUnit to test a .NET v2.0 assembly, my next task was to get it working as the debug harness for my class library projects like I did with Visual Studio 2003.

I was quite hopeful. I did everything as I had done for my VS 2003 projects…but no - they NUnit and VS2005 did not want to play nicely together! When I ran the project, NUnit did launch, but when I clicked “Run” nothing happened.

I spend a couple of hours trying to get it to work but to no avail. Eventually, out of desperation I downloaded the latest iteration build of NUnit (version 2.2.2 as of this writing). I set the 2.2.2 version of nunit-console.exe to be the startup program (remembering to update its config file with the “supportedRuntime” stuff mentioned above)…and voilà! It works a treat!

So if you can’t get NUnit to work with VS 2005 - try to download the latest drop from http://www.nunit.org/download.html

3 Responses to “NUnit and Visual Studio 2005 Beta 2”

  1. BC Says:

    Thanks for the information. I just installed NUnit and tried to run my first test and ran into the same issue. It took a few minutes of googlin’ but I found this page and helped me fix the issue. BTW, adding a ‘v’ before the version number (i.e. v2.0.50215) got everything working for me.

    Thanks again!

    /bc

  2. delbert Says:

    BC is absolutely right. the “v” in the config file is essential. it does not work without it…

  3. Stu Says:

    Absolutely, that was a typo on my part. I will correct the post.
    Thanks to both of you.

Leave a Reply