Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nunit not working in windows 7 at all

I am new to unit testing and this ism y first time trying NUnit.

My environment is windows 7 professional 64 bit, visual studio 2010 and i am working on a windows application in C#. I just wrote a single test and i am trying to run the test using NUnit GUI.

My NUnit version is 2.5.10, i also tried 4 other versions below this and i get the same error.

the error is

"System.BadImageFormatException: could not load file or assembly 'DataLogger, version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

You may be attempting to load an assembly built with a later version of the CLR than the version under which NUnit is currently running(2.0.50727) or trying to load a 64-bit assembly into a 32-bit process.

For further information, use the Exception Details menu item."

What i did is i loaded the application exe in the debug folder of the project into the NUnit GUI. (i mentioned this because i have a doubt that this could be the wrong way). Any help on this would be useful for me.

like image 993
swordfish Avatar asked Jun 17 '11 05:06

swordfish


2 Answers

I faced this problem myself. You need to use the x86 version of the application which is usually located at C:\Program Files (x86)\NUnit 2.5.10\bin\net-2.0\nunit-x86.exe And that does not throw the exception.

like image 154
Ashish Narmen Avatar answered Oct 17 '22 14:10

Ashish Narmen


I read somewhere that if we use windows 7 64 bit and developing apps for x86 then a separate GUi called nunitx86.exe in the same folder must be used. I did that and it works.

like image 29
swordfish Avatar answered Oct 17 '22 15:10

swordfish