1

I work on a large Visual Studio Solution (Sitecore Helix), with separate "feature" Projects. Some Projects have a Views > Web.config file and others do not.

During our build process, all Views end up one location/project and in that final destination the Views folder does have it's production Web.config file.

However, without a Views > Web.config file at individual the Project, there is no IntelliSense for the (dynamic) @model. Strongly typed Objects (@Html.Raw) have autocomplete/IntelliSense. As a front-end person, I really rely on the IntelliSense.

Is there a better/more appropriate way of adding these references other than to adding an individual Web.config (example below) to each Project, especially since I just need this for debug/development.

Example Web.config, please note this is not my entire Web.config file, but specifically the lines I have narrowed down to make the IntelliSense work in this case.

<?xml version="1.0" encoding="utf-8"?>

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

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="Sitecore.Mvc" />
        <add namespace="Sitecore.Mvc.Presentation" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="GCC.Feature.WebAdmin" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>


</configuration>

IntelliSense working on something other than @model Strongly Typed Objects

IntelliSense not working on @model no web config Dynamic Objects without web.config

IntelliSense working with Web.config enter image description here

Andrea
  • 46
  • 6
  • Wouldn't it be easy to just leave the file there and set it to not publish? – Camilo Terevinto Dec 04 '18 at 19:20
  • A Web.config inside the Views directory is simply required for correct functionality. Your Web.config is also incomplete, it should contain something to block direct access to the files inside the directory, unless it's not required in a Sitecore MVC project. See the proposed duplicate and [this discussion on what Web.config should contain by default](https://forums.asp.net/t/1990467.aspx?What+should+views+web+config+look+like+today) – user247702 Dec 04 '18 at 19:27
  • Possible duplicate of [What does the Web.Config file do in the views folder of a MVC project](https://stackoverflow.com/questions/6204341/what-does-the-web-config-file-do-in-the-views-folder-of-a-mvc-project) – user247702 Dec 04 '18 at 19:27

0 Answers0