Reputation: 2106
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.
Upvotes: 10
Views: 12802
Reputation: 6964
Here is what worked for me:
Step 1: Close Visual Studio with the solution you are working on.
Step 2: Delete the .vs folder in your solution folder (The .vs folder is generally hidden)
Step 3: Re-open your solution with visual studio
Thats it.
Upvotes: 0
Reputation: 2413
I have faced the same issue recently, the simplest solution is to install .net framework 4.7.1, that's it. It's because 4.7.1 is required for netstandard2!
Reference: https://github.com/xamarin/Xamarin.Forms/issues/2667
Upvotes: 0
Reputation: 111
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
Upvotes: 4
Reputation: 1201
I had this issue and the solution was a pending restart for the windows update that had to be performed. very annoying.
Upvotes: 0
Reputation: 672
I'm using VS 2017 with Xamarin Forms. These are the steps I took to resolve this error:
Upvotes: 0
Reputation: 1433
Tried all the above and failed. I mention that I use VS2017 v15.7.5.
If nothing works try this:
Close VS - all instances
Reopen VS without loading your solution
Go to Tools -> Options -> NuGet Package Manager -> Package Manager Settings -> NuGet Package Manager -> General -> Clear All NuGet Cache(s)
Load you solution and Build.
It worked for me!
Upvotes: 0
Reputation: 76790
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.
Upvotes: 20