Fix Visual Studio Razor CSHTML Intellisense in Class Library or Console application

Source: Internet
Author: User

https://mhusseini.wordpress.com/2015/02/05/ fix-visual-studio-2013-razor-cshtml-intellisense-in-class-library-or-console-application/

I tried to use A. cshtml file and the Razor syntax in a console application. I was able to build the project, but the IntelliSense and the Error tab complaint about " The name ' Model ' does not exist in the current context":

The usual fixes, like throwing in a web. config, didn ' t work. But then I found a fix to solve that problem. Here is the steps:

  • Make sure you have the Microsoft asp . NET MVC NuGet package and its dependecies installed
  • Clean and build your project, close your. Cshtml-files
  • Copy the following DLLs from Debug (or the "mode") right to the Bin folder
    • Microsoft.Web.Infrastructure.dll
    • System.Web.Helpers.dll
    • System.Web.Mvc.dll
    • System.Web.Razor.dll
    • System.Web.WebPages.Deployment.dll
    • System.Web.WebPages.dll
    • System.Web.WebPages.Razor.dll

    • Open your. cshtml file
    • It should work

      Reason:i guess it ' s because in a normal Web project there are only a bin folder, no Debug or Release. Visual Studio seems to look directly into, folder for ...

Fix Visual Studio Razor CSHTML Intellisense in Class Library or Console application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.