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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With