Edit

Share via


NuGet Warning NU1507

There are 2 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping or specify a single package source. The following sources are defined: https://api.nuget.org/v3/index.json, https://contoso.myget.org/F/development/.

Issue

A project is configured to use NuGet Central Package Management and is not configured to use Package Source Mapping. It is highly recommended to enable Package Source Mapping because it safeguards your software supply chain when your project is consuming packages from multiple package sources by allowing you specify the source for each package.

Solution

  • Onboard to Package Source Mapping if you have more than one HTTP-based NuGet package source configured when using Central Package Management.
  • If you are unable to onboard to Package Source Mapping but want to use Central Package Management, you can suppress the warning:
<PropertyGroup>
  <!-- Suppress NU1507: There are 2 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping or specify a single package source. -->
  <NoWarn>$(NoWarn);NU1507</NoWarn>
</PropertyGroup>