开发者

Error in RazorScriptManager - 0.6.1 of Nuget Gallery

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:

Error in RazorScriptManager - 0.6.1 of Nuget Gallery

Please advice on this..


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜