Where are jQuery-UI scripts stored in MVC6 project?

回眸只為那壹抹淺笑 提交于 2019-12-10 20:33:15

问题


I'm starting with MVC6 and I'm trying to use some jQuery-UI elements.

After installing the package, I cannot find the script files of jQuery-UI. While lot of tutorials on the internet tell that the files should be stored in Scripts folder (for example: <script src="@Url.Content("~/Scripts/jquery-ui-1.10.4.min.js")"></script>), it seems that it isn't the case with MVC6.

I saw this question (How to get JQuery-UI to work with ASP.NET MVC6?) in which the file is retrieved from jQuery site : <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>.

Is there any way to have files stored on our server as before ? Where are these files stored in MVC6 project ?

Thanks.


回答1:


I spent a long time trying to figure this out when I first started using .NET 5 as well. Don't install client packages with NuGet in .NET 5. Use Bower.

To install it with Bower, expand the "Dependencies" item in your project in the solution explorer. You should see a "Bower" folder there. Right-click on it and select "Manage Bower Packages". At the top of the window that opens you can choose "Browse" and then search for "jquery-ui". It should show up in the list below and you can select it and click the install button.

Once it's installed, you can find it under wwwroot/lib/jquery-ui

Then, you can reference it like this <script src="~/lib/jquery-ui/jquery-ui.js"></script>

--UPDATE--
I've been using NPM now for client packages, but the point still stands. Don't use NuGet for client packages.



来源:https://stackoverflow.com/questions/35554499/where-are-jquery-ui-scripts-stored-in-mvc6-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!