I have an ASP.NET Core Application and decided not to commit the wwwroot/lib folder with the Bower packages via Git so I included this folder in the .gitignore file.
But after deleting the wwwroot/lib folder I realized that this folder with all the Bower packages is not created automatically on build like for example the NuGet packages.
How do I accomplish that the Bower packages are automatically created/updated etc.?
Project pre-build events approach.
First, make sure you have bower installed on your machine. Command to install:
npm install -g bower
Command to test if bower is installed run the command below.
npm bower -v
In pre-build events in your project properties add following command.
CD $(MSBuildProjectDirectory)
bower install
CD $(MSBuildProjectDirectory)
was needed to make sure you run bower install
command in the folder where bower.json
is located.
Now every time you build your project bower packages will be restored based on bower.json
.
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