JetBrains Rider 2018.1 Help

Using NuGet

Tools | NuGet | NuGet Quick List
View | Tool Windows | NuGet

Rider supports installing, updating and removing NuGet packages via the NuGet window (Alt+7) and NuGet quick list (Shift+Alt+N).

Restoring NuGet packages

Rider provides two algorithms for restoring NuGet packages:

  • Normal — calls the standard NuGet restore mechanism, which can be slow, especially on .NET Core projects. It is available in the main menu (Tools | NuGet | NuGet Restore), in the NuGet quick list (Shift+Alt+N), and by clicking Restore nuget restore in the NuGet window.
  • Light — performs a number of heuristics to determine which packages should be restored. This algorithm works almost instantaneously, however there could be cases where it fails to restore some packages.
    We recommend to use this algorithm for large projects. It is available in the main menu (Tools | NuGet | NuGet Restore (Light)) or in the NuGet quick list (Shift+Alt+N).

When you open a solution, Rider will automatically apply the 'Light' algorithm to restore missing packages. If necessary, you can change the auto-restore behaviour on the NuGet settings page, which you can open by clicking NuGet Settings ThemedIcon Settings Screen Gray in the NuGet window.

Browsing installed and available NuGet packages

By default, the Packages tab of the window shows all packages installed in the whole solution, but you can change the view to only show packages of a specific project. To do so, use the scope selector next to the search box:

Rider: choosing a project to manage NuGet packages

Available packages for the selected scope are always shown below the installed packages.

You can select installed or available packages in the left part of the Packages tab, and use the right part to check package details, as well as to install, upgrade/downgrade, or remove the package in specific projects:

Rider: managing NuGet packages

Finding and installing NuGet packages

To find a NuGet package, use the search box and the list of Available packages, which appears under the list of Installed packages.
By default, Rider searches all available package sources, but you can limit the search scope using the corresponding selector:

Rider: choosing NuGet package sources

A single click on a package source will select the source and deselect all others. You can Shift-click to select multiple sources or click All feeds to select all.

To install or upgrade/downgrade a NuGet package

  1. Find the desired package as described above and select it in the left part of the Packages tab
  2. In the right part of the tab, choose a project where you want to install the selected package. If your solution contains too many projects, you may want to use the scope selector on the toolbar to display specific project and hide all others.
  3. Use the Prerelease check box on the toolbar to show or hide pre-release versions of the package.
  4. Use the Version selector in the right tab to choose the desired version of the package.
  5. Before installing the selected package, you may want to check which dependent packages will be installed. To do so, expand Frameworks and Dependencies in the right part:
    Rider: Dependencies of the selected NuGet package
  6. Depending on the selected package version, and on whether the selected package is installed in the selected project, you will be able to install, upgrade or downgrade the package.

Managing package sources

In the Sources tab of the NuGet window, Rider lists all NuGet configuration files discovered on your machine. You can add, remove, or edit package sources for the selected config file on the right panel, or click these files to open them in the editor.

If necessary, you can add or remove package sources manually, by editing the packageSources section of a configuration file. For example:

<packageSources> <add key="My online package source" value="https://some.address/"/> <add key="My local package source" value="C:\NuGetPackages\"/> </packageSources>

NuGet options

You can configure NuGet preferences in the NuGet settings page, which you can open by clicking NuGet Settings ThemedIcon Settings Screen Gray in the NuGet window or by choosing Build, Execution, Deployment | NuGet in Rider settings (Ctrl+Alt+S).

In the Search section, you can choose:

  • Include prerelease — lets you search and install pre-release versions of packages. This preference is synchronized with the same preference shown on the toolbar of the Packages tab.
  • Include unlisted — lets you search and install versions of packages that are at unlisted on the server (for example, at NuGet website). You may want to use this option to see outdated versions of packages.

Preferences in the Install and Update and in Uninstall sections work exactly the same as in Visual Studio package manager:

Visual Studio package manager options

Managing NuGet caches

NuGet caches all downloaded packages to make them available when there is no Internet connection and to prevent multiple downloads of the same package.

With Rider, you can view locations of NuGet caches and clear selected locations in the Caches tab of the NuGet window. Clearing NuGet caches is safe, it does not affect packages installed in your projects.

NuGet quick list

The most frequently used actions are available in the NuGet quick list — Shift+Alt+N or Tools | NuGet | NuGet Quick List:

Rider: NuGet quick list
Last modified: 20 August 2018