【问题标题】:Unable to load package 'Microsoft.Net.Native.SharedLibrary-x64'无法加载包“Microsoft.Net.Native.SharedLibrary-x64”
【发布时间】:2017-10-17 01:46:30
【问题描述】:

我想更新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进行更新

更新

我已经手动安装了 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

【问题讨论】:

  • 真的很奇怪的问题,就我而言,我不得不将我的默认网络 dns 从 8.8.8.8 (google) 更改为 208.67.222.222
  • @rubStackOverflow 怎么样!!!。我按照下面的答案,它有效,但它引起了另一个问题。 The “ParseILMergeInfoTask” task failed unexpectedly
  • 尝试将您的网络适配器 dns 更改为208.67.222.222,重新启动您的电脑并重试。
  • @rubStackOverflow 我住在酒店,所以无法更改我的互联网适配器 DNS。我将尝试使用我的移动数据。
  • @rubStackOverflow 它有效。我用我的移动数据下载它。所以我认为这是由于互联网连接造成的问题。

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


【解决方案1】:

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

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

解决方法

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

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

    nuget add packagePath -Source sourcePath

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

- 更新Microsoft.NETCore.UniversalWindowsPlatform 包。

【讨论】:

  • 能否请您展开第二点?使用什么[options]?能否提供一个示例添加命令行?
  • 这只是一个选项。如无特殊要求可省略。有关更多信息,您可以参考答案中添加命令行的链接,我也使用我的测试命令更新了答案。请注意,您应该将路径切换到nuget.exe所在的目录,对我来说,它是D:\
  • @VijayNirmal,我注意到失败的下载包是'Microsoft.Net.Native.SharedLibrary-x86.1.6.1'和'Microsoft.Net.Native.SharedLibrary-arm.1.6.1 ' 而不是错误日志中的“Microsoft.Net.Native.SharedLibrary-x64”,所以之前的错误已经解决,现在你可以尝试用同样的方法手动安装这两个包。
  • 我会尝试并告诉你。还有“下载包失败”错误有什么原因吗?
  • 根据错误日志,这个问题似乎是网络访问nuget.org引起的。您可以检查是否使用了 Visual Studio 中的任何代理,例如 fiddler 上的代理等。
【解决方案2】:

真的很奇怪的问题,就我而言,我不得不将我的默认网络 DNS(网卡) 从 8.8.8.8 更改为 208.67.222.222。

之后我可以更新Microsoft.NETCore.UniversalWindowsPlatform

【讨论】:

    【解决方案3】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-12
      • 1970-01-01
      • 1970-01-01
      • 2018-03-11
      • 2019-10-16
      • 2017-09-24
      • 2016-11-30
      相关资源
      最近更新 更多