Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP NET Core: How to create wwwroot/lib on build

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.?

like image 516
Palmi Avatar asked Apr 05 '17 15:04

Palmi


1 Answers

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.

Screenshot

like image 144
Ignas Avatar answered Oct 16 '22 16:10

Ignas