我无法在 Visual Studio 2010 中获取 JQuery Intellisense
我将概述我所看到的问题,并在之后立即发布问题的答案,因为我已经看到了几个讨论此问题的线程,但没有一个线程提出了我今天早上找到的补救措施。
我正在使用 Visual Studio 2010 构建一个 Web 项目,但无法获得任何 JQuery 智能感知。我确实得到了一些基本的 JavaScript Intellisense,但具体没有得到 JQuery Intellisense。
我已经完成了所有建议的故障排除 - 确保我本地有 JQuery 以排除 CDN/连接问题,确保我引用正确的 JQuery 文件等。但无济于事 - 仍然没有 JQuery Intellisense :(
I am going to outline the problem I was seeing and post the answer to the problem immediately afterwards because I've seen several threads discussing this issue but none that have presented the remedy I found this morning.
I am using Visual Studio 2010 to build a web project but cannot get any JQuery intellisense. I do get some basic JavaScript Intellisense, but specifically get no JQuery Intellisense.
I've done all the recommended troubleshooting - making sure I have JQuery locally to rule-out CDN/connectivity issues, making sure I'm referencing the correct JQuery files, etc. But to no avail - still no JQuery Intellisense :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是上述问题的解决方案:
剪切 长话短说,我使用 VS2010 中的 NuGet 包管理器窗格来运行 update-package,以防本地出现问题JQuery 包,惊讶地发现报告了一些错误:
这很奇怪。让我们看看我们安装了哪些包:
请注意,我似乎安装了多个 JQuery 包。这可能会混淆 Visual Studio 的 Javascript Intellisense 引擎。
我记得就在几周前,我更新了我的 NuGet 包,并注意到已下载了新版本的 JQuery,旧版本似乎已从我的项目中删除并替换为 JQuery-1.6.4。我认为它已经完成了,但我猜想升级过程中肯定出了什么问题。
因此,我对每个 JQuery 库多次使用“uninstall-package ...”,直到删除所有对 JQuery 的引用。
然后,我使用“install-package JQuery”将最新的 JQuery 重新添加到我的项目中。我“重建”了该项目以重新生成 JavaScript Intellisense,并且很高兴看到 JQuery Intellisense 恢复到其完整的工作状态!
本期其解决方案也记录在我的博客上:
http://www.bitcrazed.com/post/2011/10/07/How-NuGet-hosed-my-Javascript-Intellisense-but-still-saved-the-day.aspx
希望这可以帮助其他在 Visual Studio 2010 中使用 JQuery Intellisense 时遇到问题的人。
Here's the solution to the issue above:
To cut a long story short, I used the NuGet Package Manager pane in VS2010 to run update-package in case something was wrong with the local JQuery package, and was surprised to find a number of errors reported:
That’s odd. Let’s see what packages we have installed:
Notice that I appear to have multiple JQuery packages installed. This is likely confusing Visual Studio's Javascript Intellisense engine.
I remembered that just a couple of weeks ago, I’d updated my NuGet packages and noticed that a new version of JQuery had been downloaded, the old version appeared to be removed from my project and replaced with JQuery-1.6.4. I thought it had been done right, but I guess something must have gotten screwed up in the upgrade.
So, I used "uninstall-package …" several times for each JQuery library until all references to JQuery were removed.
I then used "install-package JQuery” to re-add the latest JQuery to my project. I “Rebuilt” the project to re-generate the JavaScript Intellisense, and was delighted to see JQuery Intellisense restored to its full working glory!
This issue and its resolution is also documented on my blog:
http://www.bitcrazed.com/post/2011/10/07/How-NuGet-hosed-my-Javascript-Intellisense-but-still-saved-the-day.aspx
Hope this helps others who're having problems getting JQuery Intellisense working in Visual Studio 2010.