Back to results for “Project Structure”
.NET › Assemblies & NuGet

What are NuGet package sources, and how do you configure a project to pull packages from a private/internal feed alongside NuGet.org?

Intermediate

Answer

NuGet package sources are configured (globally or per-solution via NuGet.Config) URLs NuGet searches when resolving packages -- you can add multiple sources simultaneously (e.g., NuGet.org for public packages plus an internal Azure Artifacts feed for proprietary packages), with authentication handled via API keys or credential providers for private feeds.
<!-- NuGet.Config -->
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="CompanyFeed" value="https://pkgs.dev.azure.com/mycompany/_packaging/internal/nuget/v3/index.json" />
  </packageSources>
</configuration>
Real-world example A company's internal shared libraries are published to a private Azure Artifacts feed configured alongside NuGet.org in every project's NuGet.Config, so developers use the same `dotnet add package` workflow for both public and internal dependencies.

Common follow-ups: How do you securely store credentials for a private feed in CI?;What's the package source mapping feature and why does it improve security?