I recently did a NuGet package-update on two of my projects. So I am using Microsoft.AspNet.Mvc version 5.2.0. One project is working great, the other has something out of whack because I cannot now create strongly typed razor views. Here is a snip from one of my views:
@ModelType MyServiceLibrary.EmailTemplateModelObject
Dear @Model.FirtName,<br><br>
I get the following error:
'ModelType' is not declared. It may be inaccessible due to its protection level.
Pretty much exactly what what is referenced in this question: asp.net mvc 3 'ModelType' is not declared
I have attempted to implement the recommended fix but no luck. I am using a vb.net environment. Here is what i have in my ~/Views/Web.config:
<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.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
Can anybody see what i'm doing wrong here?