我无法在 Visual Studio 2010 中获取 JQuery Intellisense

发布于 2024-12-08 20:48:17 字数 314 浏览 0 评论 0原文

我将概述我所看到的问题,并在之后立即发布问题的答案,因为我已经看到了几个讨论此问题的线程,但没有一个线程提出了我今天早上找到的补救措施。

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吹泡泡o 2024-12-15 20:48:17

以下是上述问题的解决方案:

剪切 长话短说,我使用 VS2010 中的 NuGet 包管理器窗格来运行 update-package,以防本地出现问题JQuery 包,惊讶地发现报告了一些错误:

Update-Package : 'jQuery' was not installed in any project. Update failed.
...
Update-Package : 'jQuery.vsdoc' was not installed in any project. Update failed.
...

这很奇怪。让我们看看我们安装了哪些包:

PM> get-package

Id                             Version      
--                             -------      
dotless                        1.2.1.0      
EntityFramework                4.1.10331.0  
EntityFramework                4.1.10715.0  
jQuery                         1.6.2        
jQuery                         1.6.4        
jQuery.UI.Combined             1.8.16       
jQuery.Validation              1.8.1        
jQuery.vsdoc                   1.6          

请注意,我似乎安装了多个 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:

Update-Package : 'jQuery' was not installed in any project. Update failed.
...
Update-Package : 'jQuery.vsdoc' was not installed in any project. Update failed.
...

That’s odd. Let’s see what packages we have installed:

PM> get-package

Id                             Version      
--                             -------      
dotless                        1.2.1.0      
EntityFramework                4.1.10331.0  
EntityFramework                4.1.10715.0  
jQuery                         1.6.2        
jQuery                         1.6.4        
jQuery.UI.Combined             1.8.16       
jQuery.Validation              1.8.1        
jQuery.vsdoc                   1.6          

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文