‘System.Web.Mvc.Controller’ is defined in an assembly that is not referenced

While I was playing around with the Mvc framework, I received this error message:

The type ‘System.Web.Mvc.Controller’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. 

What this simply means, is that I forgot to reference the System.Web.Extensions within my code,  in this case it was by test harness/project.

image image

However, when I looked in the .Net reference table, I couldn’t see the 3.6.0.0 assembly listed.  I went into the GAC (C:WindowsAssembly) and there it was listed but it wouldn’t let me reference the assembly. Finally, I went to C:Program FilesReference AssembliesMicrosoftFrameworkASP.NET 3.5 Extensions and added the reference from there.

Remember, if your creating your own test project with NUnit or MbUnit then you will need to reference System.Web.Extensions within that project as well.

Technorati Tags: ,

6 thoughts on “‘System.Web.Mvc.Controller’ is defined in an assembly that is not referenced”

  1. Thanks Ben, I got the same issue. I created a new MVC Application using the MVC project type, which automatically references System.Web.Extensions 3.6.0.0. I then added my own test project to the solution. When I added System.Web.Extensions from the References dialog to the test project it picked up 3.5.0.0 and I got a build error. Thanks to your post the problem was quickly solved 🙂

  2. i dont see system.web.extensions of version 3.6.0.0 in my reference assembly folder, should i need to install any software to get the same, but i can see system.web.extensions of version 3.5.0.0

  3. HEy i tried installing KIGG but its giving me an error COULD NOT LOAD KIGG.GLOBAL…thats the first line in global.asax..could you please tell what could be the solution to this?

Leave a Reply

Your email address will not be published. Required fields are marked *