Install NuGet packages in Visual Studio Code

Install NuGet packages by using the NuGet Gallery extension.
Set Visual Studio Code as the default external code editor. See Set the default code editor.
  1. From the main toolbar, select Open .NET Solution.
    The default external code editor opens.
    TIP: We recommend using Microsoft Visual Studio 2022 or Microsoft Visual Studio Code as the default code editor. Some development assistance features may not be available when using a different code editor.
  2. In Visual Studio Code, install the NuGet Gallery extension NuGet Gallery - Visual Studio Marketplace.
  3. Open the
    Command Palette
    by pressing
    .
  4. In the
    Command Palette
    , enter
    nuget
    and select
    NuGet: Open NuGet Gallery
    .
  5. Install the necessary NuGet packages.
  6. In the
    CSPROJ
    file, after the
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    property, add the
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    property.
  7. Save the
    CSPROJ
    file.
  8. Compile the project.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.