Xamarin 形式:这是否会限制对库的访问

Xamarin form: Does this give limitation access the libraries

我想在使用 .net 标准 2.0 的 Xamarin 表单上使用这些包时遇到问题

    Package 'ExifLib.PCL 1.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Microsoft.Bcl 1.1.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Microsoft.Bcl.Async 1.0.165' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Mobilist.AdvancedTimer.Forms.Plugin 1.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'PCLStorage 1.0.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Rg.Plugins.Popup 1.0.4' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

这是否意味着我不能再使用这个库了?

Does that mean I can't use this library any more?

不,您应该能够在 .NET Standard 2.0 class 库中使用几乎所有符合 PCL 规范的库。您可以查看 .NET documentation 以查看 PCL 配置文件列表及其支持的平台和相应的 .NET Standard 支持版本。


包裹警告说明

借助 .NET Standard 2.0.NET Core SDK 2+ 中更新的工具,.NET 团队希望更轻松地更新或使用 .NET Standard 库。问题是并非所有 NuGet 包都已更新以支持 .NET Standard 版本。因此,他们在 .NET Standard 中引入了 fallback targeting .NET Framework 4.6.1 which is nearly 100% compliant.NET Standard 2.0 规范中有一些 .NET Framework 4.6.1 规范中没有的 API,但它们可以通过 NuGet 包引入如果需要的话)。因此,您看到的警告是通知您这些包不符合您所针对的 .NET Standard 版本,因此可能包含 API 在您 运行 时不可执行的使用您的 .NET Standard 2.0 图书馆。

一旦您测试一切正常,您可以将 NoWarn="NU1701" 添加到 csproj 中的 PackageReference,这将删除警告。需要注意的一件事是将 NoWarn="NU1701" 添加到单个包并不会删除依赖项警告。要删除这些警告,您必须将它们包含为 PackageReferences(通过 NuGet)或忽略项目级别的 NU1701 警告。

如果您 运行 遇到后备问题,您可以通过覆盖 csproj 中的 AssetTargetFallback 来调整目标框架后备,例如:

<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wpa81;</AssetTargetFallback>