I have started a new ASP.NET Core empty project and want to add bootstrap and JQuery through bower, but there is no "bower.json" file. So i've added one with the following content:
{
"name": "asp.net",
"private": true,
"dependencies": {
"bootstrap": "3.3.7",
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6"
}
}
And then a new folder "Bower" appeared at "Dependencies" and a hidden folder "bower_components" with all the code, but the "wwwroot" remained empty, as it is shown in the following picture.
So, how can i make it to automatically add the files to the "wwwroot" folder when changing the bower.json file, so i can use it within my project?
You'll want to add a
.bowerrc
file to the root of the project. In there, you can add the following content:On a side-note, bower is no longer a recommended option for new projects. They even say it themselves on their website:
For simple ASP.NET Core projects, I personally think it would be a bit excessive to introduce
yarn
andwebpack
, so you'll most likely be fine withbower
. Another option would be to use a CDN for static resources such as bootstrap and jQuery.EDIT: The message from bower does specifically mention
front-end
projects, so perhaps they would agree with using it in your situation anyway.