I have a project on Sitecore 9.3 that uses both View and Controller renderings. My view renderings have not had any intellisense errors so far and work just fine after being built.

When I built my first Controller Rendering, I got the error "The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft'. If I add a package reference to AspNetCore v2.2.0, the intellisense errors on my Controller Rendering are fixed; however, now I see intellisense errors on all of my View Renderings.

The error on my View Renderings is "'IHtmlHelper' does not contain a definition for 'Sitecore' and the best extension method overload 'HtmlHelperExtensions.Sitecore(HtmlHelper)' requires a receiver of type 'HtmlHelper'".

I have verified that I am using the correct version of System.Web.Mvc (5.2.4) and all references in the web.config files in the views folders are the correct version. I also verified that the version of System.Web.Mvc.dll is the same in my web root.

<?xml version="1.0"?>

    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Sitecore.Mvc" />
        <add namespace="Sitecore.Mvc.Presentation"/>
        <add namespace="Sitecon.Feature.PageContent.Models"/>

    <add key="webpages:Enabled" value="false" />

      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />

        <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

I also tried adding a package reference to Microsoft.AspNet.Mvc (5.2.4) but that did not fix the problem.

I have verified that the version of the web.config file in the views folder in the web root is the same as the version in my project. All web.config files in my project have their build action set to none and copy to output directory set to do not copy so the web root is never overridden.

I am using the Sitecore Helix Templates VS Extension (if that makes a difference). If I publish the solution as-is with the intellisense errors, it makes no difference and my code works just fine when rendered on the live site. But, I would very much like to remove all intellisense errors from my solution. Thank you in advance for your help!

Edit: Adding Controller Code

using Sitecon.Feature.PageContent.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Sitecon.Feature.PageContent.Controllers
  public class PageContentController : Controller
    public ActionResult ListWithIcons()
      if (Sitecore.Context.Item == null)
        return new EmptyResult();

      var item = Sitecore.Context.Item;
      var multiLineTextString = item.Fields[Templates.ListWithIcons.Fields.ListText].Value;

      ListWithIconsItems listWithIconsItems = new ListWithIconsItems();
      listWithIconsItems.ListItems = new List<string>();

      if (string.IsNullOrEmpty(multiLineTextString))
        return new EmptyResult();

      string[] sep = new string[] { "\r\n" };
      string[] lines = multiLineTextString.Split(sep, StringSplitOptions.RemoveEmptyEntries);

      foreach (string listItem in lines)
        if (!string.IsNullOrEmpty(listItem))

      listWithIconsItems.ListIcon = item.Fields[Templates.ListWithIcons.Fields.ListIcon].Value;

      return View(listWithIconsItems);

Model Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sitecon.Feature.PageContent.Models
    public class ListWithIconsItems
      public string ListIcon { get; set; }
      public List<string> ListItems { get; set; }

Controller Rendering Code:

@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@using Sitecon.Feature.PageContent.Models
@using Sitecon.Foundation.SitecoreHelperExtensions
@model ListWithIconsItems

<ul class="fa-ul">
  @foreach (var li in Model.ListItems)
    <li><span class="fa-li"><i class="fas [email protected]"></i></span>@li</li>

Intellisense is erroring on Model.ListItems & Model.ListIcon: The name 'Model' does not exist in the current context

Intellisense Errors

  • It is unlikely you need AspNetCore for a controller rendering; Sitecore runs on the regular .NET framework. You should look into, what part of your code would require such a reference.
    – Mark Cassidy
    Feb 24, 2020 at 14:30
  • Can you include a sample of your controller code that is giving you the original namespace error. As Mark said, you shouldn't need any part of netcore in a regular controller rendering
    – Richard Seal
    Feb 24, 2020 at 14:42
  • Thanks guys, I added all relevant code. I'm sure I'm overlooking something simple! Feb 25, 2020 at 12:42

2 Answers 2


If you have upgraded to the new project type (e.g. Project Sdk="Microsoft.NET.Sdk") you'll need to add the Microsoft.AspNetCore.Mvc NuGet package. This should remove any errors regarding the AspNetCore error in Visual Studio


This has finally been solved.


    <ProjectCapability Include="SupportsSystemWeb" />

to the .csproj file

Tested and works in Visual Studio 2019 16.8.3

The example templates for the Visual Studio Helix extension will be updated with this fix asap.

  • I was about to post this and credit Anders, but here's the man himself, and I confirm it works. Make the change! Jan 11, 2021 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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