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.
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>
And the XamlGTask is underlined with a warning which says:
Task 'XamlGTask' is not defined
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.
error MSB4062: The “Xamarin.Forms.Build.Tasks.GetTasksAbi” task could not be loaded from the assembly
To resolve this issue, you should definitely make sure all projects reference the same version of the package Xamarin.Forms.
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.
Besides, some one said that install .NET Framework 4.7.1 would help solve this issue, you can check if it helps.
Certified: https://forums.xamarin.com/discussion/comment/324869#Comment_324869
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.
Hope this helps.
Solution 1:
Sometimes it helps to kill MsBuild process with taskmanager. (Press ctrl+shift+Esc)
Solution 2:
Clean Solution
Close Visual Studio
Delete all obj/bin folders
(Sometimes a delete of packages folder is required)
Restart visual studio and rebuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With