简体   繁体   中英

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

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 .

截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM