将.NET Core项目从v1.0升级到v1.1并面临以下错误

时间:2017-03-13 22:03:45

标签: upgrade asp.net-core-1.0 visual-studio-2017 .net-core-1.1

我将我的.NET Core项目从v1.0升级到v1.1并面临以下错误

包Microsoft.Net.Http 2.2.29与netcoreapp1.1(.NETCoreApp,Version = v1.1)不兼容。

包Microsoft.Bcl 1.1.10与netcoreapp1.1(.NETCoreApp,Version = v1.1)/ win10-x64

不兼容

解决方案中的所有项目都在编译并说“重建成功”#34;但是这些错误仍然出现在"错误列表"。

我正在使用Visual Studio 2017。

有修复吗?请指教。

enter image description here

1 个答案:

答案 0 :(得分:0)

检查您的输出,我刚尝试将Microsoft.Net.Http安装到我的NetCore1.1项目中并获得相同的结果。读取nuget安装的输出我看到了:

Installing Microsoft.Net.Http 2.2.29.
Package Microsoft.Net.Http 2.2.29 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Net.Http 2.2.29 supports:
  - monoandroid (MonoAndroid,Version=v0.0)
  - monotouch (MonoTouch,Version=v0.0)
  - net40 (.NETFramework,Version=v4.0)
  - net45 (.NETFramework,Version=v4.5)
  - portable-net40+sl4+win8+wp71+wpa81 (.NETPortable,Version=v0.0,Profile=net40+sl4+win8+wp71+wpa81)
  - portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
  - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
  - sl4-wp71 (Silverlight,Version=v4.0,Profile=WindowsPhone71)
  - win8 (Windows,Version=v8.0)
  - wpa81 (WindowsPhoneApp,Version=v8.1)
  - xamarinios10 (Xamarin.iOS,Version=v1.0)
Package Microsoft.Bcl 1.1.10 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Bcl 1.1.10 supports:
  - monoandroid (MonoAndroid,Version=v0.0)
  - monotouch (MonoTouch,Version=v0.0)
  - net40 (.NETFramework,Version=v4.0)
  - net45 (.NETFramework,Version=v4.5)
  - portable-net40+sl4+win8 (.NETPortable,Version=v0.0,Profile=net40+sl4+win8)
  - portable-net40+sl4+win8+wp71+wpa81 (.NETPortable,Version=v0.0,Profile=net40+sl4+win8+wp71+wpa81)
  - portable-net40+sl4+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=net40+sl4+win8+wp8+wpa81)
  - portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
  - portable-net40+win8 (.NETPortable,Version=v0.0,Profile=Profile5)
  - portable-net40+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=net40+win8+wp8+wpa81)
  - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
  - portable-net45+win8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile111)
  - portable-net451+win81 (.NETPortable,Version=v0.0,Profile=Profile44)
  - portable-net451+win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile151)
  - portable-win81+wp81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile157)
  - sl4 (Silverlight,Version=v4.0)
  - sl4-wp71 (Silverlight,Version=v4.0,Profile=WindowsPhone71)
  - sl5 (Silverlight,Version=v5.0)
  - win8 (Windows,Version=v8.0)
  - wp8 (WindowsPhone,Version=v8.0)
  - wpa81 (WindowsPhoneApp,Version=v8.1)
  - xamarinios10 (Xamarin.iOS,Version=v1.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'Notams.Query'.
Time Elapsed: 00:00:03.7728926
========== Finished ==========

如您所见,此软件包尚不支持.Net Core或.Net Standard。此外,Microsoft.Bcl依赖关系来自Microsoft.Net.Http,同样不支持.Net Standard / Core

最好的办法是切换到支持.Net Standard和.Net Core的System.Net.Http