I'm facing this issue in one of my testing instances:

Sitecore 9.1.0

Inner Exception: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\84f876eb\34615233\App_Web_events.cshtml.9351e6fa.fnj8_tct.0.cs(27): error CS0234: The type or namespace name 'MVC' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)

And I'm starting to get out of ideas.

Do you guys what should I be looking for?


closed as off-topic by Mark Cassidy Apr 20 at 10:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is in regards to the mishandling of DLL's or references, generally related to an in-progress upgrade or similar scenario. These types of questions generally involve lengthy troubleshooting in order to identify the root cause. Visit Sitecore Slack to find assistance." – Mark Cassidy
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Does your project reference Sitecore.Mvc.dll? Correct version of that dll? Is your project Target framework property set to .NET Framework 4.7.1? – Marek Musielak Apr 19 at 13:59
  • Namespaces are case sensitive? It should be Mvc not MVC. At least that's worth trying out. – Justin Laster Apr 19 at 13:59

Try to add Sitecore.Mvc namespace inside views/web.config file, like:

    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="Sitecore.Mvc" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />

Also, make sure that Sitecore.Mvc.dll in your root folder is from the correct version. To confirm, just try to copy the dll from a vanilla sitecore instance into your bin folder.


Pro tip guys, never underestimate the power of case sensitiveness.

When adding the references on views/web.config, make sure you do this:

<add namespace="Sitecore.Mvc" />

Instead of this:

<add namespace="Sitecore.MVC" />

That fixed my problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.