Adding NUnit 2.6.1 reference Visual Studio 2012

4

I'm using Visual Studio 2012, and I've downloaded NUnit 2.6.1 to run Unit Tests on the code. I've added the reference to nunit.framework in the project of the solution where I'll be needing it.

The problem is, for some reason when I try to include the namespace it doesn't work. It looks like this:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;  //This is not working here

namespace SomeNamespace
{
    [TestFixture]  //This is not recognized..
    public class SomeClassTest
    {
        [Test]  //Neither recognized..
        public void SomeMethodTest()
        {
            //Ok some implementation goes here..
        }
    }
}

Any ideas on why it's not working? Thanks in advance!

PS: I'm using ReSharper as an extension for VS2012... Can this be the source of the problem?

EDIT: I've tried to install it several times using NUGet, but I get the same error when NUGet finishes installing:

Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
Successfully uninstalled 'NUnit 2.6.1'.
Install failed. Rolling back...
Failed to add reference to 'nunit.framework'.

It makes some sort of rollback? I was reading and people say something about the GAC and adding references by hand. I don't know much about this, but could be useful to answer the question.

c#
frameworks
reference
nunit
visual-studio-2012

2 Answers

5

I have the same problem for 3 to 4 times when I installed it from NUGet. I resolved it by uninstall and reinstall it from NUGet.

answered on Stack Overflow Oct 17, 2012 by Ekk
3

Add the NUnit Reference through NUGet.

The link provides guidance for VS2010, but it's pretty much the same in VS2012.

answered on Stack Overflow Oct 17, 2012 by Dennis Traub

User contributions licensed under CC BY-SA 3.0