Xamarin形式:这是否限制了对库的访问 [英] Xamarin form: Does this give limitation access the libraries

查看:96
本文介绍了Xamarin形式:这是否限制了对库的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些软件包有问题,我想使用.net standard 2.0在我的Xamarin表单上使用这些软件包

I have a problem with these packages which I wanted to use on my Xamarin form using .net standard 2.0

    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?

推荐答案

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

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

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

No, you should be able to use nearly all libraries that are PCL spec compliant inside of a .NET Standard 2.0 class library. You can checkout the .NET documentation to see list of PCL profiles with their supported platform and their corresponding .NET Standard supported version.

包装警告说明

使用.NET Standard 2.0.NET Core SDK 2+中的更新工具,.NET团队希望使其更易于更新或使用.NET Standard库.问题在于,并非所有的Nu​​Get软件包都已更新以支持.NET Standard版本.因此,他们引入了 .NET Standard几乎100%兼容(.NET Standard 2.0规范中有一些API不在.NET Framework 4.6.1中,但可以根据需要通过NuGet软件包引入).因此,您看到的警告是通知您,这些软件包不符合您所针对的.NET Standard版本,因此,这些软件包可能包含在您的运行时中无法使用.NET Standard 2.0库执行的API.

With .NET Standard 2.0 and the updated tooling in .NET Core SDK 2+ the .NET team wanted to make it easier to update or make use of .NET Standard libraries. The issue is that not all NuGet packages have been updated to support a version of .NET Standard. So they introduced a fallback targeting .NET Framework 4.6.1 which is nearly 100% compliant with .NET Standard (There are some API that are in the .NET Standard 2.0 spec that are not in .NET Framework 4.6.1 but they can be brought in via NuGet packages if required). So the warning you see is to inform you that the packages do not conform to a .NET Standard version you are targeting and as such may contain API's that are not executable in your runtimes making use of your .NET Standard 2.0 library.

测试完所有功能后,可以将NoWarn="NU1701"添加到csproj中的PackageReference中,这将删除警告.要注意的是,将NoWarn="NU1701"添加到单个程序包并不会删除有关依赖项的警告.要删除这些警告,您必须将它们作为PackageReferences(通过NuGet)包括在内,或在项目级别忽略NU1701警告.

Once you have tested that everything is working as expect you can add the NoWarn="NU1701" to your PackageReference in your csproj which will remove the warning. One thing to note adding NoWarn="NU1701" to a individual package does not remove the warning for dependencies. To remove those warning you must either include them as PackageReferences (via NuGet) or ignore NU1701 warning at a project level.

如果遇到后备问题,可以通过将csproj中的AssetTargetFallback覆盖为以下内容来调整目标框架的后备:

If you run into fallback issues you can adjust the target framework fallback via overriding the AssetTargetFallback in your csproj to something like:

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

这篇关于Xamarin形式:这是否限制了对库的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆