Client-side package management with Library Manager in Visual Studio 2017 (libman.json)
Library Manager is a lightweight, client-side library acquisition tool. Developers can retrieve libraries like jQuery, bootstrap, Vue.js, and others from various supported CDNs or even the file system.
Not to replace with package management like NPM, yarn. Just to fetch client-side libraries files and to place them in the project file.
That’s the reason developed a lightweight, effective solution for web developers to easily manage common client-side library files. It is Visual Studio’s experimental client-side library acquisition tool.
Library files can be added to an ASP.NET Core project in two different ways:
- Use the Add Client-Side Library dialog
- Manually configure LibMan manifest file entries
Use the Add Client-Side Library dialog :
place them in your project.
Select the library provider from the provider dropdown. CDNJS is the default provider.
Type the library name to fetch in the library text box. IntelliSense provides a list of libraries beginning with the provided text.
- Select the Include all library files radio button to include all of the library's files.
- Select the Choose specific files radio button to include a subset of the library's files.
To open libman.json for editing, the following options exist:
- Double-click the libman.json file in Solution Explorer.
- Right-click the project in Solution Explorer and select Manage Client-Side Libraries.
- Select Manage Client-Side Libraries from the Visual Studio Project menu.
Libman manifest file
IntelliSense provides a list of libraries beginning with the provided @ symbol.
Add library files
Clean Client-Side Libraries: To perform the clean operation, which deletes library files previously restored in Visual Studio:
Restore Client-Side Libraries: To restore library files from within Visual Studio, there must be a valid libman.json file in the project root. Restored files are placed in the project at the location specified for each library.
First, we are going to clean client-side libraries
Check here bootstrap content deleted:
To get back which clean earlier, do restore? Click on restore
Restore files during the build
Uninstall library files:
Clicking the icon opens a tooltip listing the known background tasks.
Update library version