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…

最新文章

  1. ionic overflow:auto失效
  2. Redis数据库入门教程
  3. POJ 1850 Code
  4. 利用闭包向post回调函数传参数
  5. [ZZ]最小化不可重现的bug
  6. ntpdate[16603]: the NTP socket is in use
  7. bookhub -- 扁平化本地电子书管理与分享工具
  8. Pascal Language: Recommended Materials
  9. easyui 1.3.3 中combotree post传参问题
  10. Android学习笔记--获取传感器信息
  11. 【集训笔记】二分图及其应用【HDOJ1068【HDOJ1150【HDOJ1151
  12. windows线程同步的总结
  13. OllyDBG V1.10聆风听雨汉化版
  14. Lucene全文搜索之分词器:使用IK Analyzer中文分词器(修改IK Analyzer源码使其支持lucene5.5.x)
  15. 进击的新版NavMesh系统:看我飞檐走壁
  16. C# 构造器总结
  17. GIT入门笔记(4)- GIT 安装
  18. HTTP Status Codes 查询表
  19. timestamp时间格式
  20. 分别用for、while和do-while循环语句以及递归方法计算n!,并输出算式

热门文章

  1. BZOJ1670 [Usaco2006 Oct]Building the Moat护城河的挖掘
  2. FZU 2128 最长子串
  3. html frameset的介绍
  4. 51nod1709复杂度分析
  5. sql server中的go
  6. ORA-01034:Oracle not available
  7. Maven入门-3.pom文件和settings文件
  8. L1-038 新世界
  9. struts2的execAndWait拦截器
  10. SharePoint 2010 Ribbon with wrong style in Chrome and Safari