You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
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.
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.
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>.
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.
Activity
[-]PackageNamespaces config/source command additions[/-][+]PackageSourceMapping config/source command additions[/+]nkolev92 commentedon Sep 30, 2021
cc @JonDouglas
Zastai commentedon May 16, 2022
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.
ransagy commentedon May 16, 2022
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.
nkolev92 commentedon May 16, 2022
The CPM requirement is documented in https://docs.microsoft.com/en-us/nuget/consume-packages/central-package-management#warning-when-using-multiple-package-sources.
Please note that those tasks are not what the azure devops team recommends anymore.
They want to deprecate that and have people use
NuGetAuthenticateand issue direct commands to dotnet.exe the same way you would locally.Zastai commentedon May 16, 2022
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
NU1507toNoWarn? 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.
ransagy commentedon May 16, 2022
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.
nkolev92 commentedon May 16, 2022
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.
Zastai commentedon May 16, 2022
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.
Zastai commentedon May 17, 2022
Done - #11822. Wasn't sure what the best issue type was, so used [DCR]. I think it covers what was talked about here.
nkolev92 commentedon May 17, 2022
Thanks. We can tweak the labels if necessary.
dersia commentedon May 21, 2025
Any news on this one?
koryphaee commentedon Jan 30, 2026
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:
For now my workaround is
<WarningsNotAsErrors>NU1507</WarningsNotAsErrors>.msherms2 commentedon Nov 16, 2026
I'm somewhat surprised this hasn't gotten more traction, given the work around. For me, I found that the annoying
dotnet tool installcommand 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 adotnet nuget add packagesourcemappingfunctionality, I'm actually creating the nuget.config in powershell 🤮.I think it's much better to just do a
dotnet new nugetconfigwith somedotnet nuget addfunctionalities, personally.