ASP.net MVC 3剃须刀 - jQuery的智能感知 [英] ASP.net MVC 3 Razor - jQuery Intellisense

查看:151
本文介绍了ASP.net MVC 3剃须刀 - jQuery的智能感知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2010 / ASP.net MVC 3剃刀视图引擎。我创建了互联网应用的模板的新项目。我需要什么做的就是智能感知的工作?

I am using Visual Studio 2010 / ASP.net MVC 3 with the Razor View Engine. I created a new Project with the Internet Application template. What do I need to do to get Intellisense working?

推荐答案

如果这是jQuery的具体作为标题规定,试图将线在标签查看/共享/ _layout.cshtml (或 .vbhtml )文件:

If that's jQuery specific as the title specifies, trying adding line to the tag in the Views/Shared/_layout.cshtml (or .vbhtml) file:

@if (false) { <script src="../../Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script> }

这将引用智能感知文件的VisualStudio,但仍不能引用它在运行时。

This will reference the intellisense file to VisualStudio and still will not reference it in runtime.

记住,指向vsdoc文件比较的文件,你把这个$ C $℃下,任何code像 / Url.Content()或任何其他运行时code将是不可见的VS智能感知。结果
这正是为什么如果(假)隐藏运行时(不执行如果块)脚本参考,但不从VS智能感知隐藏它(使用 Url.Content()左右的.min.js文件提供了另一种参考)。

Just remember, point to the vsdoc file relatively to the file you put this code in. Any code like ~/Url.Content() or any other runtime code will not be visible to VS for intellisense.
That's exactly why if (false) hides the script reference from runtime (the if block isn't executed), but doesn't hide it from VS intellisense (and provide another reference using Url.Content() or so to the .min.js file).

这篇关于ASP.net MVC 3剃须刀 - jQuery的智能感知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆