简体   繁体   English

Visual Studio 2013 IntelliSense MVC5剃须刀无法正常工作

[英]VisualStudio 2013 IntelliSense for MVC5 Razor Not Working

I'm new to MVC5 and whilst writing a Layout, I am wanting to include a Partial View into it. 我是MVC5的新手,在编写布局时,我想在其中包含部分视图。

I can do that by using the syntax like 我可以通过使用类似的语法来做到这一点

@{ Html.RenderPartial("{some view name that is a partial layout}"); }

This works when I run the application, so the question isn't about getting this to run. 当我运行应用程序时,此方法有效,因此问题不在于如何运行它。

My issue is when I am writing the code for Html. 我的问题是当我为Html.编写代码时Html. I am not getting the IntelliSense showing correctly for the Html object. not正确显示Html对象的IntelliSense。

I am getting entries such as AttributeEncode, CheckBox, DropDownList, Encode, Equals etc, but I can't see RenderPartial in this list which is annoying. 我收到诸如AttributeEncode,CheckBox,DropDownList,Encode,Equals等条目,但在此列表中看不到RenderPartial ,这很烦人。

Another thing I noticed is that the ViewBag and ViewData are not coming up in the IntelliSense when I am typing the @ . 我注意到的另一件事是,当我键入@时,IntelliSense中没有出现ViewBagViewData

Everything executes fine, however I must have something configured wrong perhaps. 一切执行正常,但是我可能必须将某些配置错误。

Does anyone know how to get the IntelliSense working? 有谁知道如何使IntelliSense工作?

Sounds like the web.config in your views folder is missing or missing some namespaces. 听起来好像您的views文件夹中的web.config丢失或缺少某些名称空间。 Make a new web app project for mvc and copy the web.config out to the views folder in your project, might fix it. 为mvc新建一个Web应用程序项目,然后将web.config复制到项目中的views文件夹中,可能会修复它。

Delete the web app you made when your done. 完成后删除您制作的Web应用程序。 I stick that web.config aside for safe keeping, happens to me a lot. 我把那个web.config放在一边以保持安全,这在我身上经常发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM