错误MSB4062:"Xamarin.Forms.Build.Tasks.GetTasksAbi"无法从程序集中加载任务 [英] error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly

查看:147
本文介绍了错误MSB4062:"Xamarin.Forms.Build.Tasks.GetTasksAbi"无法从程序集中加载任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将软件包"Xamarin.Forms"和"Xamarin.Forms.Maps"更新到最新版本(即"3.0.0.446417")后,该项目将不再生成,并且出现此错误:

After updating the packages "Xamarin.Forms" and "Xamarin.Forms.Maps" to latest version i.e "3.0.0.446417", the project will no longer build and I get this error:

    C:\Users\[MyUser]\.nuget\packages\xamarin.forms\3.0.0.446417\build\netstandard2.0\Xamarin.Forms.targets(35,3):
error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly
C:\Users\[MyUser]\.nuget\packages\xamarin.forms\3.0.0.446417\build\netstandard2.0\Xamarin.Forms.Build.Tasks.dll.
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

错误指向文件 Xamarin.Forms.Targets 的此位置:

The error refers to this place of the file Xamarin.Forms.Targets:

<XamlGTask
    XamlFiles="@(EmbeddedResource)" Condition="'%(Extension)' == '.xaml' AND '$(DefaultLanguageSourceExtension)' == '.cs'"
    Language = "$(Language)"
    AssemblyName = "$(AssemblyName)"
    OutputPath = "$(IntermediateOutputPath)">
    <Output ItemName="FilesWrite" TaskParameter="GeneratedCodeFiles" />
    <Output ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
</XamlGTask>

XamlGTask的下划线带有警告,提示:

And the XamlGTask is underlined with a warning which says:

Task 'XamlGTask' is not defined

到目前为止,我要做的是清理整个解决方案,删除obj/bin文件夹,并从程序包管理器设置"中清除所有Nuget缓存",但是它们都无济于事.

What I've done so far is cleaning the whole solution, deleting the obj/bin folders and also clearing All Nuget Caches from Package Manager Settings but none of them helped.

推荐答案

错误MSB4062:无法从程序集中加载"Xamarin.Forms.Build.Tasks.GetTasksAbi"任务

error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly

要解决此问题,您绝对应确保所有项目都引用相同版本的软件包Xamarin.Forms .

To resolve this issue, you should definitely make sure all projects reference the same version of the package Xamarin.Forms.

在您的Solution Explorer中,右键单击您的解决方案节点,然后选择Manage NuGet Packages for solution....选择Consolidate选项卡,然后单击Xamarin.Forms NuGet包,确认所有项目使用相同版本.如果没有,请全部更新为相同版本.

In your Solution Explorer right click on your solution node and select Manage NuGet Packages for solution.... Select the Consolidate tab and click on the Xamarin.Forms NuGet package, confirm all projects used the same version. If not, update all to the same version.

此外,有人说安装.NET Framework 4.7.1将有助于解决此问题,您可以检查是否有帮助.

Besides, some one said that install .NET Framework 4.7.1 would help solve this issue, you can check if it helps.

经过认证: https://forums.xamarin.com/discussion/comment/324869# Comment_324869

注意:如果无法成功安装.net Framework 4.7.1,请尝试将Windows 10更新到最新版本.谢谢@Vahid.

Note: If you could not install the .net framework 4.7.1 successfully, please try to update your Windows 10 to latest release. Thanks @Vahid.

希望这会有所帮助.

这篇关于错误MSB4062:"Xamarin.Forms.Build.Tasks.GetTasksAbi"无法从程序集中加载任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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