Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: new warning for package source mappings doesn't pass a value for the resource string placeholder #11709

Closed
jimmylewis opened this issue Mar 30, 2022 · 7 comments · Fixed by NuGet/NuGet.Client#4533
Assignees
Milestone

Comments

@jimmylewis
Copy link

NuGet Product Used

MSBuild.exe

Product Version

Microsoft (R) Build Engine version 17.2.0-preview-22178-03+1160f4e0e for .NET Framework

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

Updated to a VS build containing #11505. Someone on my team started seeing this error (because we have Warnings As Errors, it broke the build):

error NU1507: There are {0} 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. [d:\dd\WebTools\WebTools.sln]

Note: the string still has {0} because it doesn't pass a value to the placeholder. Source

Additional comments:

  • Our nuget.config only has a single source. We're perplexed about why we're even getting this warning. Maybe some additional info about which feeds are being detected would also be helpful? NuGet.config contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="WebTools VSTS Feed" value="https://devdiv.pkgs.visualstudio.com/...snip..." />
  </packageSources>

  <!-- Don't let user disabled sources in VS prevent us from restoring -->
  <disabledPackageSources>
    <clear />
  </disabledPackageSources>
</configuration>
  • This isn't happening consistently. I couldn't repro on my machine, same VS build, same repo. 🤷‍♂️ There may be something different in our environments, but the message isn't helpful for us to figure out what.

Verbose Logs

No response

@jeffkl
Copy link
Contributor

jeffkl commented Mar 31, 2022

@jimmylewis sorry this warning is missing the source count. Can you run the nuget.exe sources command on a machine that emits the warning from the root of your repo to see what sources are configured?

Example:

D:\MSBuildSdks>nuget.exe sources
Registered Sources:
  1.  NuGet.org [Enabled]
      https://api.nuget.org/v3/index.json

@jimmylewis
Copy link
Author

@phenning can you post the results of your nuget.exe sources here for Jeff to see? IIRC it only had one entry, right?

@phenning
Copy link

phenning commented Mar 31, 2022

d:\dd\WebTools>assets\nuget.exe sources
Registered Sources:
  1.  WebTools VSTS Feed [Enabled]
      https://devdiv.pkgs.visualstudio.com/_packaging/WebTools/nuget/v3/index.json

@jeffkl
Copy link
Contributor

jeffkl commented Mar 31, 2022

@phenning thanks! That's weird that only one source is listed. Can you attach a project.assets.json file from one of the projects that emit the warning as well? That will have the sources that are triggering it.

@phenning
Copy link

phenning commented Mar 31, 2022

It looks like there is one being added by dotnet:

  "sources": {
    "C:\\Program Files\\dotnet\\library-packs": {},
    "https://devdiv.pkgs.visualstudio.com/_packaging/WebTools/nuget/v3/index.json": {}
  },

project.assets.json.txt

edit:
Also:


d:\dd\WebTools>dotnet nuget list source
Registered Sources:
  1.  WebTools VSTS Feed [Enabled]
      https://devdiv.pkgs.visualstudio.com/_packaging/WebTools/nuget/v3/index.json

@jeffkl
Copy link
Contributor

jeffkl commented Mar 31, 2022

@phenning so helpful thank you. To figure out where that feed is coming from, can you please attach these configs which are contributing feeds:

  • D:\dd\WebTools\NuGet.Config,
  • C:\Users\phenning\AppData\Roaming\NuGet\NuGet.Config,
  • C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config,
  • C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config,
  • C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.config

If they contain any non-public info, feel free to send them to me in email or on Teams (jeffkl@microsoft.com).

@jeffkl
Copy link
Contributor

jeffkl commented Mar 31, 2022

@phenning and I worked offline and figured out the source is coming from here:

https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.NuGetOfflineCache.targets#L17

I'm going to look into this and report back. Thanks for reporting this!

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

Successfully merging a pull request may close this issue.

4 participants