Loading, please wait...



Client-side package management with Library Manager in Visual Studio 2017 (libman.json)

Oct 16, 2019 Library Manager, Visual Studio, 339 Views
In this article, you'll see how to work with libman.js and Client-side package management with Library Manager in Visual Studio 2017.

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.

 

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, with Bower announcing they won’t be offering support into the future.

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:

  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.

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