无法加载包'Microsoft.Net.Native.SharedLibrary-x64'

时间:2017-05-17 14:21:05

标签: visual-studio uwp nuget visual-studio-2017 nuget-package

我想更新Microsoft.NETCore.UniversalWindowsPlatform,但它显示错误

Unable to load package 'Microsoft.Net.Native.SharedLibrary-x64'

如果我打开“输出”选项卡,则会显示以下内容

Restoring packages for D:\Project\Windows 10 Developement\Template\HamburgerMenu\HamburgerMenu\project.json...
  GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.universalwindowsplatform/index.json
  OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.universalwindowsplatform/index.json 938ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.universalwindowsplatform/5.3.3/microsoft.netcore.universalwindowsplatform.5.3.3.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.universalwindowsplatform/5.3.3/microsoft.netcore.universalwindowsplatform.5.3.3.nupkg 936ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.compiler/index.json
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.compiler/index.json 946ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.compiler/1.6.2/microsoft.net.native.compiler.1.6.2.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.compiler/1.6.2/microsoft.net.native.compiler.1.6.2.nupkg 938ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-arm/index.json
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/index.json
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/index.json
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-arm/index.json 481ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-arm/1.6.1/microsoft.net.native.sharedlibrary-arm.1.6.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/index.json 967ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/index.json 1438ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/1.6.1/microsoft.net.native.sharedlibrary-x86.1.6.1.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-arm/1.6.1/microsoft.net.native.sharedlibrary-arm.1.6.1.nupkg 1347ms
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x86/1.6.1/microsoft.net.native.sharedlibrary-x86.1.6.1.nupkg 1161ms
Failed to download package 'Microsoft.Net.Native.SharedLibrary-x64.1.6.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg' has timed out after 100000ms.
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg
Failed to download package 'Microsoft.Net.Native.SharedLibrary-x64.1.6.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg' has timed out after 100000ms.
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg
Failed to download package 'Microsoft.Net.Native.SharedLibrary-x64.1.6.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-x64/1.6.1/microsoft.net.native.sharedlibrary-x64.1.6.1.nupkg' has timed out after 100000ms.
Unable to load package 'Microsoft.Net.Native.SharedLibrary-x64'.
Time Elapsed: 00:27:03.1499426
========== Finished ==========

尝试解决方案

  1. 以管理员身份运行
  2. Nuget error install package Microsoft.NETCore.UniversalWindowsPlatform
  3. 使用Package Manager Console更新
  4. 更新

    我手动安装了Microsoft.Net.Native.SharedLibrary-x64。现在也没有用。

    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'.
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
      An existing connection was forcibly closed by the remote host
    Failed to download package 'Microsoft.Net.Native.SharedLibrary-arm.1.6.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.net.native.sharedlibrary-arm/1.6.1/microsoft.net.native.sharedlibrary-arm.1.6.1.nupkg'.
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
      An existing connection was forcibly closed by the remote host
    

3 个答案:

答案 0 :(得分:1)

  

无法加载包'Microsoft.Net.Native.SharedLibrary-x64'

根据错误日志,很难确定此问题是否与互联网连接,项目本身或其他问题有关,但我可以为您提供此问题的解决方法:

解决方法

  • nuget.org下载“Microsoft.Net.Native.SharedLibrary-x64”软件包。

enter image description here

  • 使用nuget add command line将该包添加到全局包文件夹C:\Users\username\.nuget\packages

    nuget add packagePath -Source sourcePath

enter image description here

之后,您会注意到该包将被添加到该文件夹​​中:

enter image description here   - 更新Microsoft.NETCore.UniversalWindowsPlatform包。

答案 1 :(得分:1)

非常奇怪的问题,在我的情况下,我不得不将我的默认网络DNS(网卡)从8.8.8.8更改为208.67.222.222。

之后我能够更新Microsoft.NETCore.UniversalWindowsPlatform

答案 2 :(得分:0)

就我而言,尝试运行UWP(通用Windows平台)项目时遇到此问题,解决方案是在Windows 10“开发人员设置”中选择“开发人员模式”