question

Heiko-6891 avatar image
0 Votes"
Heiko-6891 asked MostafaNemati-2750 commented

How to get Nuget to download packges?

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?

dotnet-package-management
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Heiko-6891 , if you try to download nuget.exe and call it to run nuget restore <YourSolution.sln> command, will it work?

1 Vote 1 ·

Thank you very much. It seems to work. I have no failures anymore, not even with a 2nd solution that I brought to the new PC.

0 Votes 0 ·

Thank you very much, you save me about 3 months. Kiss you

0 Votes 0 ·

1 Answer

cooldadtx avatar image
0 Votes"
cooldadtx answered Heiko-6891 commented

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?

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

dotnet restore does not find any packages to be restored. The nuget packages are listed in the csproj file as PackageReference.

157555-dotnetrestore.png

157584-packagesources.png

It works only for some packages and for some not.

I have no nuget or nuget.config folder in my projects.

In obj folder I have some files with 'nuget' in their name.

0 Votes 0 ·
dotnetrestore.png (51.4 KiB)
packagesources.png (15.4 KiB)

OK, so you're building a .NET Framework application so dotnet restore won't work.

In Visual Studio right click the solution and select Manage NuGet Packages for Solution. Then in the package manager UI go to the Installed tab. Do any of the packages show warnings indicating they are delisted? Can you post the portion of your project file containing the packagereference elements? The URLs you're showing as having issues look wrong to me. Normally the paths are https://api.nuget.org/v3/ and then your packages. Normally when restoring packages it pulls them from your cached local copy first if you've ever downloaded them before so the errors would seem to indicate they never successfully downloaded.

The project file should have a reference that looks like this:

<PackageReference Include="Microsoft.AppCenter" Version="4.4.0" />


0 Votes 0 ·

All Packgages in Install tab seems ok. When I update one, I get errors in a few of the dependent packages.

Project CompactStore:


 <ItemGroup>
     <PackageReference Include="Microsoft.AppCenter">
       <Version>4.4.0</Version>
     </PackageReference>
     <PackageReference Include="Microsoft.AppCenter.Analytics">
       <Version>4.4.0</Version>
     </PackageReference>
     <PackageReference Include="Microsoft.Windows.SDK.Contracts">
       <Version>10.0.22000.196</Version>
     </PackageReference>
     <PackageReference Include="System.Runtime.WindowsRuntime">
       <Version>4.7.0</Version>
     </PackageReference>
     <PackageReference Include="System.Runtime.WindowsRuntime.UI.Xaml">
       <Version>4.7.0</Version>
     </PackageReference>
   </ItemGroup>

Project CompactStoreBackgroundTask:


 <ItemGroup>
     <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
       <Version>6.2.8</Version>
     </PackageReference>
   </ItemGroup>

Package UWPHelper:


 <ItemGroup>
     <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
       <Version>6.2.8</Version>
     </PackageReference>
   </ItemGroup>




0 Votes 0 ·

Hello, Thank you for your help.

I think I will use nuget.exe in the future when I bring a solution to a new computer.

0 Votes 0 ·