如何为这个 PCL 库制作一个 NuGet 包
How to make a NuGet package for this PCL library
我正在尝试为我制作的 PCL 库创建一个 nuget 包。
这个 nuget 包旨在用于 Xamarin Forms 应用程序。所以我什至不确定我打勾的东西是否正确。
我真的只关心.NET Framework 4。那是我的最低限度的框架。至于其他的,我根本不在乎,也不知道我应该瞄准什么。
为了它的价值,我正在使用 NuGet Package Explorer 创建我的 NuGet nupkg
文件,以便在将它们发布到 NuGet 之前手动 测试它们。
这是我正在尝试的屏幕截图,但 Xamarin Studio 未能添加 nuget 包(说它不正确)。
以及来自 Xam Studio 的错误消息:
Adding Foo...
Adding 'Foo 1.3.0' to Core.
Could not install package 'Foo 1.3.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', 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 适合您的便携式 Class 库 (PCL) 项目使用的两个配置文件是配置文件 78 或配置文件 259。Xamarin.Forms 可以用于其他配置文件,但如果您的 PCL 项目针对其中之一,您应该没问题。您的项目看起来是针对 Profile 78。
这里有 Xamarin.Forms PCL 个配置文件供参考。
Xamarin.Forms 1.3:
portable-win+net45+wp80+MonoAndroid10+MonoTouch10
Xamarin.Forms 1.4:
portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
您的 NuGet 包存在问题,它没有表明它支持 PCL 中的 Windows 8。 NuGet 将查看构成项目 PCL 配置文件的所有单独框架(忽略 Xamarin 和 Mono,因为如果您的 NuGet 包的 PCL 配置文件中没有它们,它们是可选的)并确保NuGet 包的 PCL 配置文件有一个兼容的框架。如果 NuGet PCL 没有匹配的框架,则 NuGet 认为它不兼容。
因此您的 NuGet 包的可移植库文件夹需要包含 win
portable-net4+sl5+wp8+win
然后您可以将 NuGet 包安装到您的 Profile 78 PCL 项目中。
我正在尝试为我制作的 PCL 库创建一个 nuget 包。
这个 nuget 包旨在用于 Xamarin Forms 应用程序。所以我什至不确定我打勾的东西是否正确。
我真的只关心.NET Framework 4。那是我的最低限度的框架。至于其他的,我根本不在乎,也不知道我应该瞄准什么。
为了它的价值,我正在使用 NuGet Package Explorer 创建我的 NuGet nupkg
文件,以便在将它们发布到 NuGet 之前手动 测试它们。
这是我正在尝试的屏幕截图,但 Xamarin Studio 未能添加 nuget 包(说它不正确)。
以及来自 Xam Studio 的错误消息:
Adding Foo...
Adding 'Foo 1.3.0' to Core.
Could not install package 'Foo 1.3.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', 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 适合您的便携式 Class 库 (PCL) 项目使用的两个配置文件是配置文件 78 或配置文件 259。Xamarin.Forms 可以用于其他配置文件,但如果您的 PCL 项目针对其中之一,您应该没问题。您的项目看起来是针对 Profile 78。
这里有 Xamarin.Forms PCL 个配置文件供参考。
Xamarin.Forms 1.3:
portable-win+net45+wp80+MonoAndroid10+MonoTouch10
Xamarin.Forms 1.4:
portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
您的 NuGet 包存在问题,它没有表明它支持 PCL 中的 Windows 8。 NuGet 将查看构成项目 PCL 配置文件的所有单独框架(忽略 Xamarin 和 Mono,因为如果您的 NuGet 包的 PCL 配置文件中没有它们,它们是可选的)并确保NuGet 包的 PCL 配置文件有一个兼容的框架。如果 NuGet PCL 没有匹配的框架,则 NuGet 认为它不兼容。
因此您的 NuGet 包的可移植库文件夹需要包含 win
portable-net4+sl5+wp8+win
然后您可以将 NuGet 包安装到您的 Profile 78 PCL 项目中。