Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application
2015-04-10 22:04
369 查看
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 folderMicrosoft.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 workReason: 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…
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 folderMicrosoft.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 workReason: 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…
相关文章推荐
- Conditional project or library reference in Visual Studio
- How to debug c++ console application with argument in visual studio 2012
- .NET Framework 3.5 Library Source Code Shared in Visual Studio 2008
- jQuery Intellisense in Visual Studio
- [Visual Studio & Xamarin] 开发架构(四)-跨平台的MVVMCross与portable class library–Windows Phone 8
- Accessing the ASP.NET Web Configuration Tool in Visual Studio 2013
- 十:Application Lifecycle Management in Visual Studio 2008 & Team Foundation Server 2008
- CodeFluent Entities: How to add intellisense into Parts XML development in Visual Studio ?
- [Visual Studio & Xamarin] 开发架构(三)- 跨平台的MVVMCross与portable class library-Android
- proguard.ParseException: Expecting keyword 'class', 'interface', or 'enum' before '-libraryjars' in
- C++ AMP: Simultaneous CPU/GPU Debugging in Visual Studio 2013
- How to build an OLE DB application for SQL Server CE in Visual Studio 2005
- Enabling InfoPath IntelliSense Documentation in VSTA and Visual Studio
- How to disable Intellisense in Visual Studio 2008?
- Could not evaluate Expression' Debugger Abnormality in Visual Studio 2013 '
- Shortcut Collapse project or projects in the Solution Explorer Microsoft Visual Studio 2008
- Import a SharePoint Designer Reusable Workflow into Visual Studio in SharePoint 2013
- jQuery Intellisense in Visual Studio (Visual Studio提供对jQuery语法的智能感知)
- Get Intellisense for .axml files in Visual Studio
- [转载]Browser Link feature in Visual Studio Preview 2013