本文介绍了无法为netstandard1.x项目安装Netstandard1.x Nuget软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在全新安装了Windows 10以及最新的Visual Studio 2015,netcore和nuget工具之后,我无法再将Nuget软件包安装到任何.netstandard项目中。下面是一些示例输出:

After doing a fresh Windows 10 installation along with latest Visual Studio 2015, netcore, and nuget tooling - I can no longer install Nuget packages to any .netstandard projects. Here's some example output:

Restoring packages for 'ClassLibrary1'.
Restoring packages for c:\users\zone1\documents\visual studio 2015\Projects\ClassLibrary1\ClassLibrary1\project.json...
Package System.ComponentModel.EventBasedAsync 4.0.11 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package System.ComponentModel.EventBasedAsync 4.0.11 supports:
  - monoandroid10 (MonoAndroid,Version=v1.0)
  - monotouch10 (MonoTouch,Version=v1.0)
  - net45 (.NETFramework,Version=v4.5)
  - netcore50 (.NETCore,Version=v5.0)
  - netstandard1.0 (.NETStandard,Version=v1.0)
  - netstandard1.3 (.NETStandard,Version=v1.3)
  - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
  - win8 (Windows,Version=v8.0)
  - wp8 (WindowsPhone,Version=v8.0)
  - wpa81 (WindowsPhoneApp,Version=v8.1)
  - xamarinios10 (Xamarin.iOS,Version=v1.0)
  - xamarinmac20 (Xamarin.Mac,Version=v2.0)
  - xamarintvos10 (Xamarin.TVOS,Version=v1.0)
  - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0)
One or more packages are incompatible with .NETStandard,Version=v1.3.
Package restore failed for 'ClassLibrary1'.

我将项目ClassLibrary1创建为可移植类库,将目标更改为netstandard1.3,但无法安装任何显示对netstandard1.3支持的Nuget软件包。同样,netstandard1.5和其他版本也是如此。

I created the project ClassLibrary1 as a portable class library, change the target to netstandard1.3, and cannot install any Nuget packages that show support for netstandard1.3. Same goes for netstandard1.5 and the other versions.

我只是尝试为(一个支持.netstandard的项目),以验证我的项目设置是否正确,并遇到了相同的问题:

I just trying pulling and building the source for MailKit (a project that supports .netstandard) to verify I wasn't setting up my project wrong and am getting the same problem:

Errors in C:\Users\zone1\Repos\MailKit\MailKit\MailKit.CoreFX.xproj
    Package System.Net.NetworkInformation 4.1.0 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package System.Net.NetworkInformation 4.1.0 supports:
      - monoandroid10 (MonoAndroid,Version=v1.0)
      - monotouch10 (MonoTouch,Version=v1.0)
      - net45 (.NETFramework,Version=v4.5)
      - netcore50 (.NETCore,Version=v5.0)
      - netstandard1.0 (.NETStandard,Version=v1.0)
      - netstandard1.3 (.NETStandard,Version=v1.3)
      - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
      - win8 (Windows,Version=v8.0)
      - wp8 (WindowsPhone,Version=v8.0)
      - wpa81 (WindowsPhoneApp,Version=v8.1)
      - xamarinios10 (Xamarin.iOS,Version=v1.0)
      - xamarinmac20 (Xamarin.Mac,Version=v2.0)
      - xamarintvos10 (Xamarin.TVOS,Version=v1.0)
      - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0)
    One or more packages are incompatible with .NETStandard,Version=v1.3.

我在此处发布了更多详细信息:

I've posted some more details here: https://github.com/NuGet/Home/issues/3433

在重新格式化之前,所有这些都有效全新安装的Windows。我想念什么吗?

This all worked before I reformatted with a fresh Windows installation. Am I missing something?

推荐答案

感谢。

从此处()

然后运行:

nuget.exe当地-清除所有

我确保已关闭VS并删除了所有现有的project.lock.json文件。现在一切似乎都按预期工作。

I made sure to have VS closed and deleted any existing project.lock.json files. Now everything seems to work as intended.

我发现这个问题是在任何全新安装Windows / VS / tooling的系统上发生的,因此很可能是安装程序存在错误。

I found this problem to occur on any system with a fresh installation of Windows/VS/tooling so likely a bug with their installers.

这篇关于无法为netstandard1.x项目安装Netstandard1.x Nuget软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:39