MVC4, Entity Framework 5, ASP.Net 4. I am trying to make a razor helper to use across multiple Areas. This has been asked a few times, but after implementing all the solutions on Google, the problem persists.
The intellisense is recognizing the helper, but on the live server I cannot escape the compile error "The type or namespace name 'MyHelpers' could not be found (are you missing a using directive or an assembly reference?)".
Here is what I have done:
- Defined @helper class in /App_Code
- Defined @helper class in /Views/Helpers
- Added reference to MyHelper namespace in
<system.web.webPages.razor> of Views/web.config - Added reference to MyHelper namespace in <system.web.webPages.razor> of MyArea/Views/web.config
- Added all recommended using directives to top of Helper definition
- @using System.Web.Mvc;
- @using System.Web.Mvc.Html;
- @using System.Web.Mvc.Razor;
- @using System.Text.RegularExpressions
After every step, clean, build, restart visual studio, and re-published. But the helper namespace is still not recognized in the Razor compiler.
Does anyone have any ideas?