DEV Community

Cover image for NuGet Manager for VS Code: manage your .NET packages without leaving the editor
Bruno Sales
Bruno Sales

Posted on

NuGet Manager for VS Code: manage your .NET packages without leaving the editor

If you work on a .NET solution in VS Code, you have probably switched to a terminal or a browser to check which packages have updates, or to install one in a project you did not expect. I got tired of that, so I built NuGet Manager for VS Code: a NuGet window inside the editor.

The Packages tab in the editor

Its layout follows the NuGet window of JetBrains Rider, which I use as the reference for how the view should present things. The extension is not affiliated with JetBrains.

It is available on both stores:

The source is on GitHub: https://github.com/baliestri/nuget-code

What it does

  • Installed packages for the whole solution or for one project, and the packages with a newer version. Tick several and update them together.
  • Transitive packages and known vulnerabilities. The packages that come with the ones you reference are listed too, and any package with a known vulnerability is marked.
  • Discover searches your feeds, with or without prereleases.

Searching the feeds in Discover

  • Sources. Every NuGet.config NuGet reads, with the feeds of each. Add, edit, enable, disable and remove them. Private feed credentials go into the editor's secret storage, never into a NuGet.config.
  • Folders. See how much disk the NuGet caches take, and clear the ones you select.
  • Log. What NuGet and the backend are doing, as it happens, coloured by level and filtered as you like.
  • Package Manager Console. A PowerShell terminal with Get-Package, Install-Package, Update-Package and the other cmdlets you know from Visual Studio.

The Package Manager Console in the editor

Choosing the default project in the console

Versions are changed where they are declared: in the project, in Directory.Packages.props with central package management, in a VersionOverride, or in a property.

How it works

The view is a webview, and the work is done by a native backend built on NuGet.Client. The extension does not parse the output of dotnet list package. The backend reads your solution, your NuGet.config files and your feeds the way NuGet itself does, so the answers are the ones dotnet would give.

Restore can use three engines, set in nuget.restore.engine: embedded (the default, inside the backend), msbuild, or console (dotnet restore).

Requirements

  • Visual Studio Code 1.100 or newer, or an editor built from it, such as VSCodium.
  • A .NET SDK. Without one, the extension can still list sources and search packages, but cannot open a solution.
  • A trusted workspace: reading projects runs MSBuild, which executes code from the repository.
  • PowerShell 7.6 or newer, only for the Package Manager Console.

It runs on Windows, Linux (glibc and musl) and macOS, on x64 and arm64, and also in Remote SSH, WSL and containers.

Try it

Open a folder with a .sln, .slnx or .csproj, then open the NuGet tab of the panel, or run NuGet: Open from the command palette.

Feedback and bug reports are welcome on the issue tracker. If the extension saves you a few trips to the browser, a rating on your store of choice helps others find it.

Top comments (0)