How to use bower packages in Visual Studio 2017

后端 未结 3 1920
北荒
北荒 2020-12-15 19:09

Face two difficulties with bower package manager in vs2017

  1. In Visual Studio 2017, can not find any .bowerrc file under bower.json

相关标签:
3条回答
  • 2020-12-15 19:49

    Right click your project solution -> Add New Item -> select Web on the left -> select Bower Configuration File on the list -> Add

    Now you can install new bower package by right click your solution -> manage bower package.

    More details below:

    0 讨论(0)
  • 2020-12-15 20:06

    As an alternative to the suggestions of manually creating the bower.json file which will start out empty:

    • In Visual Studio right-click the Web Application project and choose Open Command line > Default (CMD), Developer Command Prompt or PowerShell.

    • If you don't have bower installed run the command npm install -g bower in the command prompt (requires npm).

    • Run the command bower init and follow the instructions which will create the bower.json file.

    If you answer yes to set currently installed components as dependencies ? and you already have packages installed in the bower_components folder it will automatically add them as dependencies in the bower.json file.

    0 讨论(0)
  • 2020-12-15 20:09

    I had the same issue.

    In the same folder as your bower.json file create the file called .bowerrc. Inside it paste:

    {
      "directory": "wwwroot/lib"
    }
    
    0 讨论(0)
提交回复
热议问题