如何确定给定 Nuget 包支持的配置文件?

How do I determine what profile a given Nuget Package supports?

2017 年 Visual Studio 我的项目中添加了一个 nuget 包。等待 5 分钟下载并安装并获取。

Could not install package 'Foo.Bar 1.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7'

所以做一些配置限制我的个人资料再试一次并获得

Could not install package 'Foo.Bar 1.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile44'

那么我如何判断 Given Nuget 支持哪些幻数?

How do I determine what profile a given Nuget Package supports?

.NETPortable 标识符用于可移植库。每个可移植库可能 运行 在许多不同的平台上,由名为 Profile_N_.

的配置文件指示

.NETPortable 标识符需要配置文件。这些配置文件如下所示:

https://portablelibraryprofiles.stephencleary.com/

因此我们可以根据该列表中的 NuGet 目标 了解给定 NuGet 支持的配置文件编号。

评论更新:

How do I determine what "NuGet Target" a given nuget package supports?

当我们给出一个nuget包时,我们可以用NuGet Package Explorer打开它,比如Newtonsoft.Json:

我们可以知道 nuget 目标是“portable-net40+sl5+win8+wp8+wpa81”和“portable-net45+win8+wp8+wpa81”,然后检查配置文件列表,我们可以知道配置文件应该是 Profile259Profile328.

希望这对您有所帮助。