Matt Ward

LibMan support in Visual Studio for Mac

The Library Manager addin provides Microsoft Library Manager (LibMan) support for Visual Studio for Mac. LibMan provides a way to install third-party client-side JavaScript libraries for ASP.NET Core and ASP.NET projects.

Features

  • Add Client-Side Library dialog
  • Restore client-side libraries
  • Deleting client-side libraries
  • Automatic client-side library restore on saving libman.json file

Full text editor support is not currently available. The following text editor quick actions are not supported:

  • Uninstall a client-side library
  • Check for client-side library updates

Supports

  • Visual Studio Mac 8.1 or later.
  • ASP.NET Core and ASP.NET projects

Add Client-Side Library Dialog

To open the Add Client-Side Library dialog, right click the project, or a folder, and select Add – Client-Side Library.

Add - Client-Side Library menu

Add Client-Side Library dialog

The library provider can be selected from the Provider list.

Typing in the Library text field will search the library provider and show a list of matching libraries.

Add Client-Side Library dialog completion list

Pressing tab or return will insert the selected library from the completion list into the Library text field.

You can then choose to include all the client-side library files or a selection of those files.

Add Client-Side Library dialog select files

The Target Location indicates where the client-side library files will be installed.

Clicking the Install button will create a libman.json file and install the client-side library into your project.

jQuery installed into project

More detailed information about the client-side library installation is available by clicking the status bar or by selecting View – Pads – Library Manager Output.

Library Manager Output window

Adding a libman.json file

To add a libman.json file without using the Add Client-Side Library dialog, right click the ASP.NET project and select Manage Client-Side Libraries.

Manage Client-Side Libraries menu

This will create a libman.json file and open it in the text editor.

libman.json file in text editor

Restoring Client-Side Libraries

To restore the client-side libraries you can right click the libman.json file in the Solution window and select Restore Client-Side Libraries.

Restore Client-Side Libraries menu

Information about the restore operation is available from the Library Manager Output window.

Alternatively saving the libman.json file in the text editor will run a restore.

Restore errors are displayed in the Errors window and in the libman.json file if it is open in the text editor.

LibMan restore error

Deleting Client-Side Libraries

To remove the client-side libraries you can right click the libman.json file in the Solution window and select Clean Client-Side Libraries.

Clean Client-Side Libraries menu

This will delete the client-side libraries from the project.

Library Manager Addin Installation

The Library Manager addin is available from the Visual Studio for Mac extensions repository. To install the addin:

  • From the main menu, open the Extensions Manager dialog.
  • Select the Gallery tab.
  • Expand IDE extensions.
  • Select the Library Manager addin
  • Click the Refresh button if the addin is not visible.
  • Click Install… to install the addin.
  • Restart Visual Studio for Mac.

Links