Search code examples
c#rider

Install nuget package jetbrains rider


I would like to install a package i downloaded called swatch.AutofacConfiguration.1.3.0.nupkg

I have it stored locally. I just dont know how to install it.

I have tried using commands like nuget install nuget add -Source some/directory my.nupkg

I would like to add it to my solution please


Solution

  • In Rider, open the NuGet tool window (in the Tools|NuGet menu, at least in MacOS) and go to the Sources tab. There, click on a nuget.config file and add a local source. Here is the documentation: https://www.jetbrains.com/help/rider/Using_NuGet.html#sources

    You can also open the config file directly and add a folder as a package source. On MacOS, the file is at ~/.nuget/NuGet/NuGet.Config, and in Windows it should be in %appdata%\NuGet\NuGet.Config. Here is an abbreviated version of my file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="Local" value="LocalNuGetPackages" />
      </packageSources>
    </configuration>
    

    The File specification gives examples for Windows, but not for MacOS/Linux. It seems that the value is a path relative to ~/.nuget/NuGet on MacOS, so I created the folder ~/.nuget/NuGet/LocalNuGetPackages and put my NuGet packages there.