Share via


[UWP]How set nuget timeout in Visual Studio?

Question

Monday, July 17, 2017 6:33 AM

I cleared all nuget caches thruough Tools->Options->NuGet Package Manager, now I'm having trouble to restore packages in my projects.

Restoring NuGet packages...
Failed to download package 'Microsoft.Net.Native.SharedLibrary-x86.1.6.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/1.6.1/microsoft.net.native.sharedlibrary-x86.1.6.1.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/1.6.1/microsoft.net.native.sharedlibrary-x86.1.6.1.nupkg' has timed out after 100000ms.
All packages are already installed and there is nothing to restore.
Time Elapsed: 01:14:35.0749005

I remember Microsoft.Net.Native.SharedLibrary-x86.1.6.1 was peculiar when I first tried to download this package. NuGet seems always got stuck on this package and only until many tries I finally got this package.

Is there any way to set nuget timeout so that I can retry with my will?

EDIT: It seems nuget always re-download all the packages even though they are already downloaded. Attaching screenshot of C:\Users\usre\AppData\Local\NuGet\v3-cache\1ca707a4d90792ce8e42453d4e350886a0fdaa4d$ps_api.nuget.org_v3_index.json

Ignorance is blissful

All replies (3)

Wednesday, July 19, 2017 2:53 AM âś…Answered

yes, the timeout issue is more related to your network. I noticed that you are come from China, as we know, most of the network is restricted to access, so the network download would be very slow and the package "Microsoft.Net.Native.SharedLibrary-x86" has more than 70M. This should be the reason for the timeout. You can try to use the VPN or set your own NuGet repository locally should be a great recommendation:

Steps to set local fed:

1. Create a local folder, such as, "D:\LocalServer"

2. Add this path to the package source, Tools->Options->NuGet Package Manager->Package Sources.

3. Download the package Microsoft.Net.Native.SharedLibrary from nuget.org, then you can install the package to your project from the local feed.

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Tuesday, July 18, 2017 11:30 AM

Hi Neo the 1,

Thanks for posting here.

>>>Is there any way to set nuget timeout so that I can retry with my will?

I don't believe there is a way to set NuGet timeout. Generally people have the opposite problem in that NuGet gets an HTTP timeout while trying to restore the package. But one thing you can do if you are finding the response time of NuGet Package Restore to be too slow, is to create your own NuGet repository locally, download the package from NuGet.org, then put the packages on that repository instead. This is also usually a good idea to better control individual developers going rogue ****

Besides, I have even encountered the similar issue on SO, the solution is that change the default network DNS(network card) from 8.8.8.8 to 208.67.222.222. And I have also provided the detailed steps to create the repository locally, you can check if it works fine.

 >>>It seems nuget always re-download all the packages even though they are already downloaded.

How did you restore your package? Have you ever clean the nuget cache or the packages in the Packages folder? I suggest you can open a new thread about this issue with more detail info, I will keep follow it.

Hope this can help you.

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Tuesday, July 18, 2017 4:19 PM

Thanks for the tips, it seems I'm not alone regarding this peculiar package.

On the re-download problem, I have already submitted a bug report.

Ignorance is blissful