【问题标题】:Error updating JScript IntelliSense with Google Apis hosted jQuery使用 Google API 托管的 jQuery 更新 JScript IntelliSense 时出错
【发布时间】:2009-04-26 14:02:58
【问题描述】:

我在我的应用程序中通过:http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js 引用 jQuery。

这会在 vs.net 中生成错误:“更新 JScript IntelliSense 时出错:c:...jquery.min-fds90[1]..js:对象不支持此属性或方法 @18:9345。

除了将 javascript 文件的本地副本放在我的开发箱上之外,还有其他方法可以解决此问题吗?

顺便说一句,带有此修补程序的 VS.Net 2008 SP1 会发生这种情况:http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx

【问题讨论】:

  • 这真是个混蛋!我很惊讶它没有得到更广泛的报道。除了使用 non-min 版本之外,任何人都有其他解决方案,或者 Microsoft 或 jQuery 是否正在修复?

标签: jquery visual-studio


【解决方案1】:

我终于找到了这个问题的答案:

基本上,将以下内容添加到您的 jQuery 包含:

<% /* %><script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2-vsdoc.js"></script><% */ %>

通过:http://biasecurities.com/blog/2009/get-jquery-intellisense-in-vs-net-when-using-a-cdn/

【讨论】:

  • 我使用这个解决方案,但我使用 if (false) { } 而不是包裹在 /* 和 */ 中,它做同样的事情,但 ReSharper 不会抱怨它。所以,我使用&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;&lt;% if (false) { %&gt;&lt;script src="../../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"&gt;&lt;/script&gt;&lt;% } %&gt;。尽管次要版本不匹配,但它工作正常。
  • 感谢 microsoft -vsdoc 链接!
  • 当我尝试添加&lt;% /* %&gt; 或克里斯的版本&lt;% if (false) { %&gt; 时,第一个版本出现语法错误,第二个版本出现错误'If' must end with a matching 'End If'.。是的,结束标签在那里,就像上面写的一样。我做错了什么?
【解决方案2】:

我认为问题在于 jQuery 网站上的 vsdoc 文件有一个稍微不正确的文件名,这让 VS 感到困惑。

请看这里:
http://patrickyong.net/2009/05/08/error-updating-jscript-intellisense-object-doesnt-support-this-property-or-method-21391/

【讨论】:

  • 有趣...这似乎仍然是 vs.net 的错误或 jQuery 和 MS 之间的协作问题。
【解决方案3】:

我也遇到这个问题。
仅当您使用 jQuery 的缩小版本时才会出现此问题。

您可以在开发中使用未压缩的版本。

【讨论】:

    【解决方案4】:

    我发现 Rick Strahl 的文章是 jQuery 的一个非常好的开始,包括他关于 intellesense 和 Visual Studio 设置的笔记

    You can find his here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-25
      • 1970-01-01
      • 2020-07-25
      • 2020-01-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多