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

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…
时间: 2024-08-24 15:37:36

Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application的相关文章

Solving GitHub FetchHead (MergeConflict) in Visual Studio 2013

I was getting the error: An error occurred. Detailed message: An error was raised by libgit2. Category = FetchHead (MergeConflict). 3 conflicts prevent checkout. To resolve this problem, I installed the 3rd-party Git command prompt tools, then you ca

Visual Studio 2013 在使用 razor无智能提示的解决办法

网上看到的方法都差不多,但是我感觉没怎么说详细,因此,截图备注下: 1.开始->Microsoft Visual Studio 2013->Visual Studio  Tools->Visual Studio 2013 命令提示(英文版的名字是:"Developer Command Prompt for VS2013") 2.cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7    (按照Co

使用Visual Studio 2013 调试 MASM 汇编程序!

原文地址:http://kipirvine.com/asm/debug/vstudio2013/index.htm Using the Microsoft Visual Studio 2013 Debugger Updated 6/21/2014 This tutorial explains how to use the Microsoft Visual Studio 2013 Debugger to debug 32-bit assembly language programs running

在Visual Studio 2013 上开发Node.js程序

[题外话] 最近准备用Node.js做些东西,于是找找看能否有Visual Studio上的插件以方便开发.结果还真找到了一个,来自微软的Node.js Tools for Visual Studio(NTVS),虽然现在仅发布了1.0 Alpha版本,但使用起来已经非常方便.而且,其开发团队与Python Tools for Visual Studio(PTVS)是同一个,而PTVS就是Visual Studio 2013中要创建自带的Python项目需要安装的那个程序,所以大可放心的使用NT

在 Visual Studio 2013 中使用 Grunt, Bower 和 NPM

在 Visual Studio 2015 中提供了对于 Grunt 和 Gulp 的内置支持,在 Visual Studio 2013 中怎么办呢?微软将 2015 中的特性作为几个独立的扩展发布出来,你可以在 Visual Studio 2013 中同样使用这个特性. 实际上,你需要三个扩展. 1. 安装 首先,你需要 Visual Studio 2013.3,也就是说,安装了 Visual Studio 的第三个更新包. 1. Task Runner Explorer Grunt 的可视化任

Visual Studio 2013开启JavaScript的智能提示功能

在前一次的发布的时候,我们共享了Visual Studio 2013中Windows Azure移动服务的集成和功能.其中包含了移动服务表脚本的编辑能力的介绍.这一次的发布,我们将描述在Visual Studio中怎么样在你的服务器脚本中激活智能提示.这个功能并没有被集成到Visual Studio 2013 预览版中,下边的步骤可以帮助你把它打开. 开始之前,请从这里下载我们的IntelliSense定义文件.将这些文件保存到一个相对容易访问的路径. 智能提示知多少? 我们今天将要发布的文件能

Visual Studio 2013 Web开发、新增功能:“Browser Link”

微软正式发布Visual Studio 2013 RTM版,微软还发布了Visual Studio 2013的最终版本..NET 4.5.1以及Team Foundation Server 2013.下面我们体验下Visual Studio 2013 Web开发方面有哪些特性,具体可以参看http://www.asp.net/visual-studio/overview/2013/release-notes. 1..net framework 2.0/3.0/3.5/4.0/4.5/4.5.1

Visual Studio 2013 Web开发新特性

微软正式发布Visual Studio 2013 RTM版,微软还发布了Visual Studio 2013的最终版本..NET 4.5.1以及Team Foundation Server 2013.下面我们体验下Visual Studio 2013 Web开发方面有哪些特性,具体可以参看http://www.asp.net/visual-studio/overview/2013/release-notes. 1..net framework 2.0/3.0/3.5/4.0/4.5/4.5.1

Visual Studio 2013的新特性介绍

cnbeta新闻:微软正式发布Visual Studio 2013 RTM版,微软还发布了Visual Studio 2013的最终版本..NET 4.5.1以及Team Foundation Server 2013.下面我们体验下Visual Studio 2013 Web开发方面有哪些特性,具体可以参看http://www.asp.net/visual-studio/overview/2013/release-notes. 1..NET Framework 2.0/3.0/3.5/4.0/4