Missing reference to System.Web.Mvc in Asp.net Unit Test?

前端 未结 2 1183
隐瞒了意图╮
隐瞒了意图╮ 2021-02-18 23:09

I recently made some unit tests for my Asp.NET MVC application, or I tried to, it keep telling me \"The type \'System.Web.Mvc.Controller\' is defined in an assembly that is not

2条回答
  •  梦谈多话
    2021-02-18 23:21

    An educated guess, but you might have obtained the newer version via a nuget package(some of the newer MVC project templates do this), and thus it is not installed in GAC. Use the nuget package manager for the MVC project to determine if this is the case, and if so then mystery solved.

    In the test project you can add the same package, or use the addreference->Browse to browse into the nuget dependencies and poke around under the MVC project till you find the DLL(it will be in the file system somewhere under SolutionName/MvcProjectName/packages).

提交回复
热议问题