码迷,mamicode.com
首页 > 移动开发 > 详细

Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application

时间:2015-04-10 22:26:03      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

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 are 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 you’re in) 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 is only a bin folder, no Debug or Release. Visual Studio seems to look directly into that folder for…

 

Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application

标签:

原文地址:http://www.cnblogs.com/baozhu/p/4415785.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!