Home: Restoring packages with GitHub Package Repository configured generates warnings

Created on 30 Sep 2019  路  22Comments  路  Source: NuGet/Home

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): NuGet.exe, dotnet restore and Visual Studio

NuGet version (x.x.x.xxx): 5.3.0.6260

dotnet.exe --version (if appropriate): 3.0.100

VS version (if appropriate): 16.3.1

OS version (i.e. win10 v1607 (14393.321)): Win10 v1903 (18362.356) and Linux Docker container (sdk:3.0-alpine)

Worked before? If so, with which NuGet version: first try at this

Detailed repro steps so we can see the same problem

  1. Configure solution to use GitHub package repository via nuget.config
  2. Add package references to the project (for example to Newtonsoft.Json)
  3. Restore the project witch caches cleared
    3.1. Either run dotnet nuget locals all --clear or build inside Docker
  4. Get warning like this: `NuGet.targets(123,5): warning : NAME_UNKNOWN:Package with name 'newtonsoft.json' was not found in the package source 'organizationName' [/path/to/solution.sln]

Other suggested things

Packages are actually restored successfully, only these warnings show up with every restore/build commands and I haven't found any way to suppress it.

Verbose Logs

Detailed logs from Docker build of attached project
docker-build-output.log

Sample Project

Issue repro. You need to update nuget.config with GitHub PAT that can download packages.
nuget-restore-issue-repro.zip

New Issues 2 External Bug

Most helpful comment

Bump

All 22 comments

I have the EXACT same issue. It's a shame to see it's been nearly 2 months and no response, at all :(

I have the same issues as well.

Bump

The issue is still present.

Got the same Problem, ist there a way to supress this warnings?

This is a bug in GPR. When NuGet makes a call to the GPR server to fetch a non-existent package, it properly returns HTTP-404, just like nuget.org does. However, unlike nuget.org, it also adds a X-Nuget-Warning header on the response containing the exact warning message you're seeing (example: X-Nuget-Warning: NAME_UNKNOWN:Package with name 'coverlet.msbuild' was not found in the package source 'organizationName'). GPR is misusing that header -- according to https://github.com/NuGet/Home/wiki/%5BSpec%5D-Server-side-warnings-for-NuGet-client it should be used just for warnings and errors, which this isn't.

Solution is for the GPR devs to stop sending that header in their 404 response.

I've brought this up with GitHub and they have an internal issue open with their engineering team tracking this bug. No ETA yet.

You might suppress these warnings by setting MSBuild properties HideWarningsAndErrors as true and EmitAssetsLogMessages as false until it is fixed.

Can you provide an example how to configure that? And does it disable ALL warning, include others than NuGet ones?

You can just put these elements in your .csproj file like this:

<PropertyGroup>
  <HideWarningsAndErrors>true</HideWarningsAndErrors>
  <EmitAssetsLogMessages>false</EmitAssetsLogMessages>
</PropertyGroup>

or pass CLI argument like dotnet build -p:HideWarningsAndErrors=true -p:EmitAssetsLogMessages=false
You can confirm it by inspecting the output of dotnet build PROJECT -pp:out.xml. HideWarningsAndErrors is only used in the Restore target, and EmitAssetsLogMessage is only used in RunResolvePackageDependencies and ReportAssetsLogMessages targets. It is not used outside.

I've brought this up with GitHub and they have an internal issue open with their engineering team tracking this bug. No ETA yet.

Any one have word on this? Seems like something that would be simple for GPR to fix, but 20+ days later, still an issue.

Still relevant, and annoying.

I have the same Issue, it is still present.

Comon. Gitlab just released nuget package support, stop me from going there.....

Doing what @foriequal0 suggested and that worked. So dotnet publish "Foo.sln" -c Release -p:HideWarningsAndErrors=true -p:EmitAssetsLogMessages=false -o out

Same issue

also same here

Another workaround, which does not potentially hide relevant warnings/errors:

  • comment out the GPR source in NuGet config
  • run dotnet build (or possibly just dotnet restore)

    • this should not give the warning

  • re-enable the GPR source
  • further builds should be fine again, at least until the local package cache is cleared again

This has now been fixed at the GitHub Packages end!

Build before the fix was deployed:

image

...buld after:

image

Looks like it's working! 馃帀

@jirikopecky could you confirm and close this issue if you agree? 馃檹

I have forwarded the issue to GitHub folks. But I also see it seems to have been fixed. @jirikopecky can you confirm if your issue has been fixed?

Hello, I am currently out of office. I will be able to verify it in the week of 11th May

Hello, I can confirm that the issue have been fixed. Thanks for your help!

Was this page helpful?
0 / 5 - 0 ratings