Palmi
Palmi

Reputation: 2521

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

Upvotes: 6

Views: 2179

Answers (1)

Ignas
Ignas

Reputation: 4328

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

Upvotes: 4

Related Questions