RazorScriptManager 中的错误 - Nuget Gallery 0.6.1

发布于 2024-11-16 19:11:15 字数 877 浏览 2 评论 0原文

我正在使用 RazorScriptManager - 0.6.1 来缩小我的 asp 的 js 和 css 文件.net mvc 3 应用程序。

当我使用 AddJavaScript 方法时:

@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-1.7.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)
@Script.OutputJavaScript()

它显示 jquery-1.6.min.js 引用之后的任何脚本引用的 js 错误。以下是错误的屏幕截图:

RazorScriptManager Error 请大家给点建议..

I am using RazorScriptManager - 0.6.1 to minify my js and css files for my asp.net mvc 3 application.

When i use AddJavaScript method as:

@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-1.7.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)
@Script.OutputJavaScript()

It shows js error for any script reference that comes after jquery-1.6.min.js reference. Below is the screenshot of the error:

RazorScriptManager Error
Please advice on this..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

蓝海似她心 2024-11-23 19:11:15

看来这可能是与 JavaScript 相关的问题,而不是脚本管理器的问题。

错误本身似乎出现在 jquery.validate.min.js 中,它是在引用 Modernizr-1.7.min.js 之后加载的。我创建了一个空的示例项目,引用与您相同的 JavaScript 文件(除了 1.6.1 而不是 1.6),并且我确实遇到了脚本版本之间的冲突。我更新了示例项目以使用最新版本,并且没有错误:

@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.1.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-2.0.6-development-only.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true) //v1.8.1
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)

尝试更新项目中的所有 JavaScript NuGet 包,看看是否可以解决您的问题。如果没有,请在 GitHub 上的项目中提出问题,我会查看一下。

It appears this might be a JavaScript-related issue, not a problem with the script manager.

The error itself appears to be in jquery.validate.min.js, which is being loaded after the reference to modernizr-1.7.min.js. I created an empty sample project referencing the same JavaScript files as you did (except with 1.6.1 instead of 1.6), and I did run into a conflict between script versions. I updated my sample project to use the latest versions, and I have no errors:

@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.1.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-2.0.6-development-only.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true) //v1.8.1
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)

Try updating all the JavaScript NuGet packages in your project and see if that solves your problem. If it doesn't, open an issue in the project on GitHub and I'll take a look at it.

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