不知道如何为这个PCL库制作NuGet包

我正在尝试为我制作的PCL库创建一个nuget包。

此nuget包旨在用于Xamarin Forms应用程序。 所以我甚至不确定我勾选的东西是否正确。

真的只关心.NET Framework 4.这是最基本的框架。 对于其他人,我根本不在乎,也不知道我应该针对什么。

有人可以帮帮我吗?

FWIW,我正在使用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,两个适合您的可移植类库(PCL)项目的配置文件是Profile 78或Profile 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项目中。