Nuget还原失败,"包不兼容"错误

时间:2016-07-06 20:09:00

标签: c# .net visual-studio nuget

我不确定我的解决方案中究竟有什么更新但我在尝试构建时遇到了很多错误。 Visual Studio中的错误列表有一堆错误,如下所示:

  

Package System.Xml.XmlSerializer 4.0.10与portable45-net45 + win8(.NETPortable,Version = v4.5,Profile = Profile7)不兼容。 Package System.Xml.XmlSerializer 4.0.10支持:

     
      
  • dnxcore50(DNXCore,Version = v5.0)
  •   
  • dotnet(.NETPlatform,Version = v5.0)
  •   
  • monoandroid10(MonoAndroid,Version = v1.0)
  •   
  • monotouch10(MonoTouch,Version = v1.0)
  •   
  • net46(.NETFramework,Version = v4.6)
  •   
  • netcore50(.NETCore,Version = v5.0)
  •   
  • xamarinios10(Xamarin.iOS,Version = v1.0)
  •   
  • xamarinmac20(Xamarin.Mac,Version = v2.0)
  •   

它表示适用于各种System和Microsoft命名空间的包。在我的Build输出结束时,它说:

  

一个或多个软件包与之不兼容   .NETPortable,Version = v4.5,Profile = Profile7(win10-x86-aot)。的NuGet   包恢复失败。

但是,即使出现错误,我的解决方案仍然可以构建并运行正常。如何摆脱错误列表中的错误以及它们来自何处?在错误列表中,它没有说明错误导致的项目,文件或行号。

1 个答案:

答案 0 :(得分:1)

首先,您应该使用4.0.11,它支持.NET Platform Standard,

https://www.nuget.org/packages/System.xml.xmlserializer

其次,将您的NuGet VS插件更新到最新版本,以便它可以正确解决PCL和.NET Platform Standard之间的关系。