Homepage | About Me | Testing ASP.net Book | Best Blog Posts | Personal Projects | Follow me on Twitter | GitHub | SlideShare | RSS
Blog.BenHall.me.uk

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

Sunday, December 16, 2007

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:\Windows\Assembly) and there it was listed but it wouldn't let me reference the assembly. Finally, I went to C:\Program Files\Reference Assemblies\Microsoft\Framework\ASP.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: ,

Labels:

Blogger comments

At 12:13 PM, Anonymous SoulSolutions said...
Exact same problem today, great answer - thanks for blogging it!    
At 10:10 AM, Blogger Mike Hadlow said...
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 :)    
At 11:39 AM, Blogger ramesh said...
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    
At 10:17 PM, Anonymous Jay said...
i'm having the same issue as ramesh, any suggestions?    
At 3:23 PM, Anonymous Xiaojie said...
thank you very much!I had the same question.And now I got it finally.    
At 7:02 PM, Blogger Ajay Sharma said...
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?