How to get Nuget to download packges?

Heiko 1,191 Reputation points
2021-12-14T12:26:51.74+00:00

For days I have been trying to install Nuget packages for my Solution. I let VS 2022 do that during the build of the solution. Unfortunately, I always get incomprehensible download errors. If I take any URL that Nuget can't download and enter it in Edge, the download starts immediately with no problems.

Build Output:

Rebuild started...
Restored D:\VS Community 2022\MyProjects\AppsMenu\AppsMenuBackgroundTask\AppsMenuBackgroundTask.csproj (in 1,1 sec).
Restored D:\VS Community 2022\MyProjects\AppsMenu\UWPHelper\UWPHelper.csproj (in 1,1 sec).
Restored D:\VS Community 2022\MyProjects\AppsMenu\AppsMenu\AppsMenu.csproj (in 1,1 sec).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/index.json'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/index.json' has timed out after 100000ms.
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x64.microsoft.net.native.sharedlibrary/index.json'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-x64.microsoft.net.native.sharedlibrary/index.json' has timed out after 100000ms.
Failed to download package 'runtime.win10-x86.Microsoft.Net.Native.SharedLibrary.2.2.8-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.sharedlibrary/2.2.8-rel-29722-00/runtime.win10-x86.microsoft.net.native.sharedlibrary.2.2.8-rel-29722-00.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.sharedlibrary/2.2.8-rel-29722-00/runtime.win10-x86.microsoft.net.native.sharedlibrary.2.2.8-rel-29722-00.nupkg' has timed out after 100000ms.
Failed to download package 'runtime.win10-arm.Microsoft.Net.Native.SharedLibrary.2.2.8-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/2.2.8-rel-29722-00/runtime.win10-arm.microsoft.net.native.sharedlibrary.2.2.8-rel-29722-00.nupkg'.
Cannot access a disposed object.
Object name: 'SslStream'.


Package Manager Output:

Failed to download package 'runtime.win10-arm64.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm64.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-arm64.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-arm64.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-arm64.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg' has timed out after 100000ms.
Failed to download package 'runtime.win10-x86.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-x86.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-x86.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg' has timed out after 100000ms.
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x64.microsoft.net.native.sharedlibrary/index.json'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-x64.microsoft.net.native.sharedlibrary/index.json' has timed out after 100000ms.
Failed to download package 'runtime.win10-x86.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-x86.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg'.
Cannot access a disposed object.
Object name: 'SslStream'.
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/index.json'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/index.json' has timed out after 100000ms.
Failed to download package 'runtime.win10-arm64.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm64.microsoft.net.native.compiler/2.2.10-rel-29722-00/runtime.win10-arm64.microsoft.net.native.compiler.2.2.10-rel-29722-00.nupkg'.
Cannot access a disposed object.
Object name: 'SslStream'.
Failed to download package 'runtime.win10-arm.Microsoft.Net.Native.SharedLibrary.2.2.8-rel-29722-00' from 'https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/2.2.8-rel-29722-00/runtime.win10-arm.microsoft.net.native.sharedlibrary.2.2.8-rel-29722-00.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-arm.microsoft.net.native.sharedlibrary/2.2.8-rel-29722-00/runtime.win10-arm.microsoft.net.native.sharedlibrary.2.2.8-rel-29722-00.nupkg' has timed out after 100000ms.
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.compiler/index.json'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/runtime.win10-x86.microsoft.net.native.compiler/index.json' has timed out after 100000ms.
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
Time Elapsed: 00:07:56.1911580
========== Finished ==========

Error occurred while restoring NuGet packages: The feed 'nuget.org [https://api.nuget.org/v3/index.json]' lists package 'runtime.win10-x86.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.

The last message is also incomprehensible. 'runtime.win10-x86.Microsoft.Net.Native.Compiler.2.2.10-rel-29722-00' is supposed to be included in https://api.nuget.org/v3/index.json, but it is not.

I need the following Nuget packages in my solution:

Microsoft.AppCenter
Microsoft.AppCenter.Analytics
Microsoft.Windows.SDK.Contracts
Microsoft.NETCore.UniversalWindowsPlatform
Microsoft.Windows.SDK.BuildTools

These nuget packages can be downloaded, but their dependencies cannot. How can I solve the problem?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,261 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 45,986 Reputation points
    2021-12-14T15:44:46.68+00:00

    Go to a developer command prompt for VS 2022. Go to your solution directory. Run dotnet restore. Does it work?

    What are the package sources you have configured for Nuget? You can find these under Tools \ Options -> NuGet Package Manager\Package Sources.

    It sounds like it works for some packages and not others, is that correct?

    Do you have a nuget folder or nuget.config file in your project?