Search code examples
c#asp.net-mvcunit-testingcontrollergac

ViewResult exists both in "System.Web.Mvc.dll" and "System.Web.Mvc.dll"


I am writing a unit test for a controller method in my MVC4 project.

And as a part of - Act - phase I am :-

var result  = controller.SomeMethod(SomeViewModel) as ViewResult;

when I get the error - ViewResult exists both in "System.Web.Mvc.dll" and "System.Web.Mvc.dll".

In my project solution I do have a single reference to this assembly. I do have 2 different versions in the GAC.

What should the course of action be for fixing this one?


Solution

  • The test project had MVC 4.0 referenced and the project under test had MVC 3.0 referenced. FWIW answering it here.