Face two difficulties with bower package manager in vs2017
In Visual Studio 2017, can not find any .bowerrc
file under bower.json
, so how to set the directory property? After Installation via Manage Bower Packages UI, packages store files in bower_components
folder
How to use those packages, as in previous versions like VS 2013 write syntax in BundleConfig.cs
to manage client packages like below. Now in VS 2017, how to use those packages in a C# Core 2 ASP.NET MVC project?
BundleConfig.cs
:
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/bower_components/jquery/dist/jquery.js",
"~/bower_components/jquery-file-upload/js/vendor/jquery.ui.widget.js",
"~/bower_components/jquery-file-upload/js/jquery.fileupload.js",
"~/bower_components/jquery-file-upload/js/jquery.iframe-transport.js"));
}
}
I had the same issue.
In the same folder as your bower.json
file create the file called .bowerrc
. Inside it paste:
{
"directory": "wwwroot/lib"
}
Right click your project solution
-> Add New Item
-> select Web on the left
-> select Bower Configuration File on the list
-> Add
Now you can install new bower package by right click your solution -> manage bower package.
More details below:
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