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.
 
It's not to replace with package management like npm, yarn, rather, just to fetch client side library files and to place them in the project file.
 
If we are developing a modern web app, chances are your app will reference client-side JavaScript and CSS files like jQuery or bootstrap. Maybe you copy these from a previous project, download them, or use Bower. However,  Bower has announced they won’t be offering support in the future.
 
That’s the reason for 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:
  1. Use the Add Client-Side Library dialog
  2. Manually configure LibMan manifest file entries

Use the Add Client-Side Library dialog

 
Place them in your project.
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Select the library provider from the provider dropdown. CDNJS is the default provider.
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Type the library name to fetch in the library text box. IntelliSense provides a list of libraries beginning with the provided text.
 
Client-Side Package Management With Library Manager In Visual Studio 
  • 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.
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio 
 
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
 
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio 
 
IntelliSense provides a list of libraries beginning with the provided @ symbol.
 
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio 
 
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.
 
Client-Side Package Management With Library Manager In Visual Studio 
 
First, we are going to clean client side libraries,
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Check here if bootstrap content was deleted,
 
Client-Side Package Management With Library Manager In Visual Studio 
 
To get back what was cleaned earlier, do restore? Click on restore,
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Restore files during the build
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Uninstall library files
 
Clicking the icon opens a tooltip listing the known background tasks.
 
Client-Side Package Management With Library Manager In Visual Studio
 
Client-Side Package Management With Library Manager In Visual Studio 
 
Update library version
 
Client-Side Package Management With Library Manager In Visual Studio 


Similar Articles