MVC3 - Razor view engine, why i need to reference class library on individual pages?

I have referenced the class library in web.config under pages -> namespaces. Why do i have to reference these again on my individual pages?

I think i have missed some thing critical due to which reason i have to do this. Any help with this will be greatly appreciated.

I had my references under the global web.config. I need to move these to individual areas web.config also. But why?

Pages.Namespaces is a tool for WebForms and the WebForms view engine. Razor doesn’t look there but rather to it’s own more localized configuration. It was a [good] design decision.


Go into your /Views folder and edit the web.config there, then see if your razor views doesn’t pick it up. =)

Thats the first thing i did, after global web.config. Views under my areas don’t pick these up. I had to moves these to area web.config also.