【问题标题】:Cannot add redux.NET to basic Xamarin.Forms project via nuget无法通过 nuget 将 redux.NET 添加到基本 Xamarin.Forms 项目
【发布时间】:2017-02-10 12:12:16
【问题描述】:

Xamarin.forms 和 PCL 的新手,当我收到以下错误时,我正在尝试通过 nuget 将 https://github.com/GuillaumeSalles/redux.NET 添加到 Hello world Xamarin.forms 项目:

Could not install package 'Redux.NET 1.0.1'. You are trying to install this package into a project that targets 
'.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 

我需要以什么框架为目标 - 我应该尝试将 Xamarin.forms 入门项目更新到该框架吗?是否有我可以查看的包配置文件以了解该库所依赖的 .net 版本?

我在 .nuspec 文件中看到的唯一依赖项是我已经添加的 System.Reactive 3.0.0。

这是我尝试添加 redux 之前的 packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="System.Reactive" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="System.Reactive.Core" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="System.Reactive.Interfaces" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="System.Reactive.Linq" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="System.Reactive.PlatformServices" version="3.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="Xamarin.Forms" version="2.3.1.114" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>

【问题讨论】:

    标签: c# nuget xamarin.forms portable-class-library


    【解决方案1】:

    Redux.NET 1.0.1 在其 NuGet 包中有一个可移植类库程序集文件夹:

    portable-net45+netcore45
    

    这映射到 PCL 配置文件 7。

    如果您更改项目以使用该配置文件,那么 Redux.NET 将安装到其中而不会出现任何错误。

    为了解决这个问题,我查看了 NuGet 包的内部,它基本上是一个具有不同扩展名的 .zip 文件,然后使用 Stephen Cleary's portable library profiles site 来查看哪个配置文件与该配置文件完全匹配或最接近。

    【讨论】:

    • 当我切换到配置文件 7 时,我收到错误消息,指出 Reactive 包和 Xamarin.Forms 现在不兼容。我应该只要求 Redux.NET 所有者更新他的包吗?
    • Reactive 和 Xamarin.Forms NuGet 包(最新版本和您正在使用的版本)都可以很好地安装到针对配置文件 7 的新 PCL 项目中。这已使用 Xamarin Studio 6.1 进行了测试。
    • 好的,我删除了现有的 xamarin.forms 和响应式包并重新添加,现在它可以工作了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 2018-01-10
    相关资源
    最近更新 更多