简体   繁体   中英

ASP.net MVC project: should I update jQuery version?

When you create an ASP.net MVC project in Visual Studio (even the newest version, VS 2017) it includes a very old version of jQuery , version 1.10.2 to be precise.

The question is: can I safely upgrade to the latest 3.x versions? Or is there a good reason why the ASP.net MVC template includes 1.x by default?

NOTE: I haven't written any code yet, so there will be no problem on my part, I'm just wondering if it will break something in ASP.net/MVC and the default libs that ship with it.

When you are creating new project it simply uses existing project template. The template was created long time ago and I do think it is not updated since then. That is the reason jQuery version is 1.10.2 as this version was available at the time template was created. In general jQuery is there because Microsoft.jQuery.Unobtrusive.Validation NuGet package. This package is dependent on jQuery >= 1.8 and jQuery.Validation >= 1.8.0.1 .

You might want to take a look at jQuery upgrade guides , if you want to be 100% sure, but I don't see any other connection to jQuery in new project and it is safe to update it. I have never had problems updating every NuGet package to latest right from the start.

it's Completely Okay to change the Version your self with the version you want it wont affect the Asp.net at all i did it its 100% safe. you can update:

 pm> Update-Package jQuery 

Update Any Front-end Based function Wont affect The asp.net in anyway just in case you written some code before it may affect your Views(Html) only not anything else at all its a Clint side script anyway

由于您没有在应用程序中编写任何代码,因此您可以包含新的jquery版本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM