4

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 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

For those also wondering, you will first need to install npm and bower before you can use bower in visual studio!
I think the answer to this question should also explain why we no longer use Nuget and need Bower or NPM now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.