The name "Model" does not exist in the current context. ASP.NET MVC5

I encode PlugIn in NopCommerce 3.2, and in the views I get the error mentioned above, but also for Layout and Html. I copied the same Web.Config that works in another plugin. I also added the same links as in the working plugin. When the compilation of the plugin works, but I do not have any intellisense and I can not trust that VisualStudio correctly notes errors. I am using VS2013 Professional Update 1.

Here is the Web.Config file:

<?xml version="1.0" encoding="utf-8"?> <!-- We use this file to make razor intellisense work in the class library --> <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> <appSettings> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <compilation targetFramework="4.5" /> <pages 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"> <controls> <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> </controls> <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> </namespaces> </pages> </system.web> <system.web.webPages.razor> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <pages pageBaseType="Nop.Web.Framework.ViewEngines.Razor.WebViewPage"> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> </namespaces> </pages> </system.web.webPages.razor> </configuration> 

EDIT: Sorry if you found that this question has not been investigated, but I assure you that I took hours to try to find a solution (including those questions that I found here in stackoverflow that are similar and point to the web. config as a problem, so I included this file in my question), but I can not find it.

+8
c # web-config asp.net-mvc-5 nopcommerce
source share
10 answers

This error was probably caused by Resharper. We are a team of three developers using GIT. One of us installed Resharper, and that probably caused an error for the other two of us. When we installed the trial version of Resharper, it worked again. Unfortunately, it does not work when uninstalling Resharper again ...

+4
source share

Try adding this section to system.web. (Make sure the versions I added are indeed the ones you are using)

 <compilation targetFramework="4.5"> <assemblies> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </assemblies> </compilation> 

Close the .cshtml files. Rebuild the project. And open them again.

+3
source share

Without installing the MVC Nuget Package project and reinstalling it, he fixed it for me. My problem went wrong when I changed the version of the .net project.

+3
source share

Verify that the namespace you defined in the view matches your model namespace.

+2
source share

If you change the project properties to target 4.5.1,

targetFramework in LOTS of other places will still say 45

You can find targetFramework 3-4 times in your root web.config and in all kinds of package.config.

I had the same problem, change Project to target 4.5, and it cleared up.

Best not to target 4.5.1

+2
source share

I had the same problem. The solution was to uninstall the MVC Nuget Package project and reinstall it.

http://mhammadchehab.com/wordpress/2013/12/enabling-intellisense-for-razor-in-class-library-mvc-5-razor-3-0/

+2
source share

Change the Project Exit path to /bin for All Configurations in Project Properties . This is strange, but it seems that when VS Project Output moves to /bin/Debug or /bin/Release , intellisense is completely open.

project properties

+2
source share

I experienced the same error in my MVC 5 project. My thing was that the Web.config folder in the Views folders was not published in any way. By adding it, the problem is resolved.

+2
source share

I had the same error and just changed in

I'm just trying to get cshtml intellisense in a console application so that it works for me to return to the standard base web page.

+1
source share

In my case, I had to reset the Visual Studio component cache by closing Visual Studio and deleting this folder:

C: \ Users \ [username] \ AppData \ Local \ Microsoft \ VisualStudio \ 14.0 \ ComponentModelCache

0
source share

All Articles