• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1577
  • Last Modified:

NUnit and System.BadImageFormatException

I am using NUnit-Gui version 2.2.0 and VS2005.  I created a C# class project.  Here is my code:

using System;
using NUnit.Framework;

namespace NUnitQuickStart
{
    [TestFixture]
    public class NumbersFixture
    {
        [Test]
        public void AddTwoNumbers()
        {
            int a = 1;
            int b = 2;
            int sum = a + b;
            Assert.AreEqual(3, sum);
        }
    }
}
This project was built without any error.   I try to debug this project by using NUnit-Gui.  I go to FileĆ  Open and clicked on NUnitQuickStart.dll.   I got the following error message:
"System.BadImageFormatException". The format of the file "PCM.Brokers.Tests" is invalid

Please help me resolve this problem.
0
lina06
Asked:
lina06
  • 2
  • 2
1 Solution
 
andrewjbCommented:
So, you start the NUNit GUI..
click File / Open Project
Browse to the bin/debug/ directory under your C# project
Open the dll, which is the output of your c# project compilation...?

That's exactly correct. Sounds like the build isn't working or something... Are you _sure_ you're opening the right .dll?

Try remocing the dll, rebuilding the project, and making sure it gets created again!
0
 
lina06Author Commented:
Yes, several times I removed dll and rebuilt the project.  It gave me the same error.
0
 
andrewjbCommented:
Try getting the latest version. On older versions you had to tweak a config to choose between .net 1 and .net2 - maybe you've not done that?

What's PCM.Brokers.Tests? Is it you file? Is there more code to your project that you're not showing, or is the posted code the entirity of the project you're trying to Nunit test for the moment?
0
 
lina06Author Commented:
Thank you.
I downloaded NUnit-Net-2.02.2.8 and it woks fine for me.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now