the project reference does not compile 'should be reference'

advertisements

In the following new test project I've created for testing the web code I have the following error when trying to compile my code.

Not sure what this means because I've added the reference to the project including the controllers into the test project??

Any ideas

Many thanks, James

Error message

Error   330 The type 'Web.Supporting.BaseControllers.PowerController' is defined in an assembly that is not referenced. You must add a reference to assembly 'Web.Areas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Power\Test.Unit.Web.Portal\Controllers\SearchProductControllerTests.cs   39  13  Test.Unit.Web.Portal

UPDATE

Tried adding system.web.mvc into the test project although I can't see it, see image below

UPDATE

Found it by looking at an existing test project. Can't see it in the dialog (???) but I located it here: C:..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll


Did you include reference to Web.Areas library which it is asking for? If not add it.

If you already have a reference to it then "Target Framework Version" will be the problem. If your current project is targeted to lesser version than the referenced assemblies this will happen. Ex: If current project targets to .net4.0 and Web.Areas is targeted to .net4.5 this error will appear.

To fix it you may need to downgrade all other projects version or upgrade current project's version.