Autofac 4支持哪些PCL配置文件?



我们在我们的PCL (Profile259)中使用Autofac 3.5.2, Nuget告诉我们4.1版本可用,但是当我们试图更新它时,Nuget失败了,消息:

"你正在尝试将这个包安装到一个目标为'portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+ xamarinintvos10 +xamarinwatchos10+xamarinios10'的项目中,但该包不包含任何与该框架兼容的程序集引用或内容文件。欲了解更多信息,请联系软件包作者。"

有谁能够得到Autofac 4.1工作在任何PCL配置文件?

谢谢!汤姆b .

Autofac 4是使用netstandard目标框架发布的,该框架是新的。net Core平台的一部分。netstandard的重点是用更容易理解的东西取代无数的和稍微令人困惑的PCL目标。

Autofac 4支持netstandard1.1 . netstandard TFM("目标框架绰号")上的文档解释了它的兼容性。简而言之:

  • 。净4.5+ ( net45)
  • 单声道/Xamarin平台通用Windows平台10 (uap10.0)
  • Windows 8.0 (win8.0)
  • Windows Phone 8.1 (wpa8.1)

它不支持Windows Phone Silverlight (wp8.0) -结束于netstandard1.0

netstandard1.1与这些PCL配置文件兼容(也根据文档):

  • Profile7
  • Profile32
  • Profile44
  • Profile111
  • Profile151

它不兼容Profile259 -那是netstandard1.0。不兼容的是Windows Phone Silverlight目标,它已被弃用,并且在Autofac 4中不再支持。

变通方法:

添加project.json到您的项目:

{
  "dependencies": {
    "Autofac": "4.2.0",
    // your other dependencies here
  },
  "frameworks": {
    ".NETPortable,Version=v4.5,Profile=Profile111": {}
  },
  "supports": ""
}

关闭并重新打开项目(可能还有Xamarin Studio)。我还向Xamarin Studio添加了Nuget v3提要(我刚刚列出了版本2),但我不确定这是否有帮助。

最新更新