Thursday, 7 December 2017

c# - The name 'Model' does not exist in the current context ASP.NET MVC5

itemprop="text">

I am coding a PlugIn to NopCommerce
3.2, and in the views I get the error mentioned above, but also for 'Layout' and 'Html'.
I have copied the same Web.Config that works in another plugin. I have also added the
same references as used in the working Plugin. When compiling the plugin works, but I
don't have any intellisense and can't trust that VisualStudio marks errors correctly. I
am using VS2013 Professional Update 1.



Here is
the Web.Config file:



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










type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,
System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission="false" />

type="System.Web.WebPages.Razor.Configuration.RazorPagesSection,
System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false" />





/>

key="PreserveLoginUrl" value="true" />
key="ClientValidationEnabled" value="true" />
key="UnobtrusiveJavaScriptEnabled" value="true" />




targetFramework="4.5" />

validateRequest="false"

pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc,
Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"

pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"

userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.0.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35">


tagPrefix="mvc" />







namespace="System.Web.Mvc.Ajax" />
/>

namespace="System.Web.WebPages" />







factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
pageBaseType="Nop.Web.Framework.ViewEngines.Razor.WebViewPage">





namespace="System.Web.Mvc.Html" />
/>








EDIT:
Sorry if you find this question not researched, but I assure you I have spent hours to
try to find the solution (including those questions I have found here in stackoverflow
that are similar and pointing out web.config as the problem which is the reason I have
included that file in my question) but can't find it.



Answer




This error was probably caused by Resharper.
We are a team of three developers using GIT. One of us installed Resharper, and this
probably caused the error for the other two of us. When we installed Resharper trial it
suddenly worked again. Unfortunately it isn't working when uninstalling Resharper
again...


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...