Skip to content

PackageSourceMapping config/source command additions #10735

Open

Description

@nkolev92

Child of #6867.

This covers adding the respective dotnet.exe and nuget.exe commands to edit the config namespaces.

Activity

  1. added
    Area:PackageSourceMapping
    Priority:2
    on Apr 8, 2021
  2. changed the title [-]PackageNamespaces config/source command additions[/-] [+]PackageSourceMapping config/source command additions[/+] on Sep 30, 2021
  3. nkolev92 commented on Sep 30, 2021

    @nkolev92
    MemberAuthor
  4. Zastai commented on May 16, 2022

    @Zastai

    With a Visual Studio now released that actively requires source mapping when using central version management with more than one source, it'll be more important to be able to do this.

  5. ransagy commented on May 16, 2022

    @ransagy

    Is there documentation for this change of it being required? So far I've noticed it as a warning only. Seeing as how there are still some open issues on using source mapping (like the very basic restore tasks in Azure Pipelines not supporting it) I'd be surprised if this became a breaking change.

  6. nkolev92 commented on May 16, 2022

    @nkolev92
    MemberAuthor

    The CPM requirement is documented in https://docs.microsoft.com/en-us/nuget/consume-packages/central-package-management#warning-when-using-multiple-package-sources.

    like the very basic restore tasks in Azure Pipelines not supporting it

    Please note that those tasks are not what the azure devops team recommends anymore.
    They want to deprecate that and have people use NuGetAuthenticate and issue direct commands to dotnet.exe the same way you would locally.

  7. Zastai commented on May 16, 2022

    @Zastai

    Well, the warning is now documented, yes. What is not documented is why the warning is issued. Is it just a strong recommendation? Or will there be actual breakages if I add NU1507 to NoWarn? If so, what kind of breakages?

    Note that given warnings-as-errors is a common thing in release builds, the introduction of the warning is a potentially breaking change, and should probably have been given more visibility in release notes.

  8. ransagy commented on May 16, 2022

    @ransagy

    The CPM requirement is documented in https://docs.microsoft.com/en-us/nuget/consume-packages/central-package-management#warning-when-using-multiple-package-sources.

    like the very basic restore tasks in Azure Pipelines not supporting it

    Please note that those tasks are not what the azure devops team recommends anymore. They want to deprecate that and have people use NuGetAuthenticate and issue direct commands to dotnet.exe the same way you would locally.

    Warning and Required are two different things. Will a restore/build break or stop if no source mapping is enabled in any current released VS/NuGet/dotnet CLI?

    Also; key word, want to. Which is another new, relatively jarring change esp. if the above is true.

  9. nkolev92 commented on May 16, 2022

    @nkolev92
    MemberAuthor

    I'd appreciate if you folks could file an issue at NuGet/Home with these questions, that way others can discover this discussion.

    I'll loop in right people to help answer your questions and concerns.

  10. Zastai commented on May 16, 2022

    @Zastai

    Warning and Required are two different things. Will a restore/build break or stop if no source mapping is enabled in any current released VS/NuGet/dotnet CLI?

    Only when warnings-are-errors is set, which is not an uncommon release build scenario.

    Which is why it's relevant to know what, if anything, will break if the warning is inhibited via NoWarn, which would be the obvious workaround.

    It's also not super clear to me whether it's the presence of source mapping that us required, or whether the mapping has to be non-overlapping. I'll have to see whether setting the mapping for both sources to "*" will make the warning go away.

  11. Zastai commented on May 17, 2022

    @Zastai

    I'd appreciate if you folks could file an issue at NuGet/Home with these questions, that way others can discover this discussion.

    I'll loop in right people to help answer your questions and concerns.

    Done - #11822. Wasn't sure what the best issue type was, so used [DCR]. I think it covers what was talked about here.

  12. nkolev92 commented on May 17, 2022

    @nkolev92
    MemberAuthor

    Thanks. We can tweak the labels if necessary.

  13. dersia commented on May 21, 2025

    @dersia

    Any news on this one?

  14. koryphaee commented on Jan 30, 2026

    @koryphaee

    I am using central package management + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> which results this error when trying to restore from a pipeline:

    error NU1507: Warning As Error: There are 2 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. The following sources are defined: nuget.org, ***

    I have added my local feed but without source mapping I cannot build. I have two options:

    • Use a local nuget.config file for this repo. This sucks because the feed URL is hardcoded.
    • Disable the warning. This sucks because I don't get the advantages of package source mapping.

    For now my workaround is <WarningsNotAsErrors>NU1507</WarningsNotAsErrors>.

  15. msherms2 commented on Nov 16, 2026

    @msherms2

    I'm somewhat surprised this hasn't gotten more traction, given the work around. For me, I found that the annoying dotnet tool install command is great about adding a source on the fly, but not so much about only using that source, without a nuget.config. Since mine are decided conditionally, I have to create a nuget.config on the fly, and because of the lack of a dotnet nuget add packagesourcemapping functionality, I'm actually creating the nuget.config in powershell 🤮.

    I think it's much better to just do a dotnet new nugetconfig with some dotnet nuget add functionalities, personally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:PackageSourceMappingPriority:2Product:NuGet.exeProduct:dotnet.exeTriage:NeedsDesignSpecType:Feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions