在 Xamarin 可移植类库中使用 FluentMigrator

雷安克法尔

我在 VS 2017 Community Edition 中创建了一个 Xamarin Forms 项目。我想使用 FluentMigrator 创建一个在应用程序中使用的数据库。

当我尝试使用 NuGet PM 将 FluentMigrator 安装到项目中时,出现以下错误:

Could not install package 'FluentMigrator 1.6.2'. 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.

我猜这是我的项目使用.NETPortable 的事实。

是否可以在 Xamarin PCL 中使用 FluentMigrator?如果是这样,我的项目配置需要更改什么?

马特·沃德

FluentMigrator 没有任何与 PCL 项目兼容的程序集。它包含两个 lib 目录:35 和 40。它们似乎具有用于 .NET 3.5 和 .NET 4.0 的 .NET 程序集。所以你不能把它安装到 PCL 项目中。

相反,我会看看您是否可以创建一个 .NET 项目,比如针对 .NET 4.5,然后将 FluentMigrator NuGet 包安装到该项目中并在那里定义您的迁移。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章