Bug 60293 - Netstandard Project + Xamarin.Forms 2.5.0-pre2 Error MSB4062: The “Xamarin.Forms.Build.Tasks.GetTasksAbi” task could not be loaded from the assembly
Summary: Netstandard Project + Xamarin.Forms 2.5.0-pre2 Error MSB4062: The “Xamarin.Fo...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Mac OS
: Highest normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-10-20 18:51 UTC by Brandon Minnick
Modified: 2018-04-14 02:20 UTC (History)
18 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 60293 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Brandon Minnick 2017-10-20 18:51:22 UTC
Build Error:
/Users/brandonm/.nuget/packages/xamarin.forms/,3): Error MSB4062: The “Xamarin.Forms.Build.Tasks.GetTasksAbi” task could not be loaded from the assembly /Users/brandonm/.nuget/packages/xamarin.forms/  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. (MSB4062) (UITestSampleApp)

Reproduction Steps:
-Download Reproduction App
-Open reproduction app in Visual Studio for Mac (Stable Channel as of 20 Oct 2017)
-Build the Android Project
-Build should fail with the above error

Reproduction App:

Visual Studio Community 2017 for Mac
Version 7.2 (build 636)
Installation UUID: 6e5142b4-e8be-4d1c-b75e-4744b0d8c3de
	Mono (2017-06/71277e78f6e) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504000201


.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Versions:
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Sdks

Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 9.0.1 (13249)
Build 9A1004

Version: (Visual Studio Community)
Hash: 2f8bbec0
Branch: d15-4-xi
Build date: 2017-10-05 20:56:05-0400

Version: (Visual Studio Community)
Android SDK: /Users/brandonm/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0
SDK Build Tools Version: 26.0.1

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:

Version: (Visual Studio Community)

Xamarin Inspector
Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

Build Information
Release ID: 702000636
Git revision: b349c8fc0c2e1aab0179917d56eed75eb3a03337
Build date: 2017-10-06 15:20:04-04
Xamarin addins: a8da992c78f7eb65b3cdb3f951c34a30337cab35
Build lane: monodevelop-lion-d15-4

Operating System
Mac OS X 10.13.0
Darwin 17.0.0 Darwin Kernel Version 17.0.0
    Thu Aug 24 21:48:19 PDT 2017
    root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

Enabled user installed addins
Azure Functions development (Preview) 7.2
NuGet Package Management Extensions 0.12.2
Comment 1 batmaci 2017-10-22 01:15:47 UTC
I am having the same problem here. Cleaning nuget package folder and restoring fixes the error but time to time, it reoccurs.
Comment 2 Matt Ward 2017-10-23 09:17:10 UTC
Some of the projects in the solution use different Xamarin.Forms versions. I would look at modifying the projects so they all use the same versions to see if this resolves the problem. With different Xamarin.Forms versions being imported the MSBuild host may load a different version which does not have the required build task.



The UITest projects have an import for an older Xamarin.Forms but do not have it in the list of packages in the packages.config file. I would remove that import:

Comment 3 David Ortinau [MSFT] 2017-11-16 04:30:21 UTC
Email report from Infragistics. This one is Windows. I've seen this recently on Visual Studio for Mac, though not always. 

"Just upgraded Prism to Xamarin and now I get a build error.
Suppression State
The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\BLagunas\.nuget\packages\xamarin.forms\\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.  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.
Any ideas?"
Comment 4 Matt Ward 2017-11-16 10:16:25 UTC
Testing with VSMac

1) Create Blank XamarinForms project
2) Build solution.
3) Update Xamarin.Forms to latest in all projects
4) Build solution

Build succeeds - see some warnings about FormsViewGroup.dll which seems to have been compiled against MonoAndroid v8.0. The previous XamarinForms 2.4 was compiled against MonoAndroid v7.0.

/Users/matt/Projects/Tests/wegweg23wegwg/Droid/wegweg23wegwg.Droid.csproj: Warning XA0105: The $(TargetFrameworkVersion) for FormsViewGroup.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. (XA0105) (wegweg23wegwg.Droid)

The https://github.com/brminnick/UITestSampleApp/tree/XamarinForms_2.5.0.19271-pre2 reproduces the problem about being unable to load the GetTasksAbi task from the Xamarin.Forms 2.5 build task.

Whilst the UITestSampleApp projects have a mix of Xamarin.Forms MSBuild targets
imported this does not seem to be the problem since only the XamarinForms_2.5.0.19271-pre2  NuGet package is restored into the solution's packages folder. The problem here is that MyLoginUI uses Xamarin.Forms when it compiles so the other projects fail to compile since the MSBuild task is loaded.

MyLoginUI uses the Xam.Plugins.Forms.CustomReturnEntry which depends on Xamarin.Forms It does not have its own explicit Xamarin.Forms package reference. The fix here is to add the Xamarin.Forms package reference to the MyLoginUI project. Then reload the solution.
Comment 5 Andrei.N 2017-11-16 11:21:18 UTC
I have same issue and looks like others have it too https://forums.xamarin.com/discussion/comment/307054
Comment 6 Matt Ward 2017-11-16 11:59:02 UTC
One problem I have found in VS Mac 7.3 is when a .NET Standard project is used and Xamarin.Forms is upgraded. To repro:

1) Create a new .NETStandard 2.0 project.
2) Install Xamarin.Forms
3) Build the project.
4) Upgrade to the latest stable Xamarin.Forms 2.5
5) Build the project.

Expected result:

Build succeeds.

Actual result:

Build fails with the GetTasksAbi error.

Error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly ~/.nuget/packages/xamarin.forms/  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. (MSB4062)

Reloading the solution fixes the build error.

A PCL project does not have the same problem.
Comment 8 dhaligas 2017-11-17 17:22:06 UTC
@matt ward I tried the steps above but still getting the error.
Comment 9 Matt Ward 2017-11-17 17:39:58 UTC
@dhaligas - The steps in Comment 4? They were specific for Brandon's github repository so your solution may have a different problem. Once the same Xamarin.Forms version is being used in all projects in the solution then that should fix the problem. With VS Mac you would need to close and re-open the solution to ensure the old Xamarin.Forms build tasks are not loaded if build is failing with the failure to load the GetTasksAbi task. If that is still happening then I would look at the diagnostic MSBuild output ("msbuild /v:diag > build.log") or the generated obj/project.assets.json files, to see if a project is still using an older Xamarin.Forms dll.
Comment 10 dhaligas 2017-11-20 17:31:09 UTC
Matt none of these steps worked now it is saying 

.nuget/packages/xamarin.forms/,3): Error MSB4036: The "GetTasksAbi" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin" directory. (MSB4036) (Core)

This is painful
Comment 11 dhaligas 2017-11-20 20:56:07 UTC
@matt I found that we still had a {ProjectName}.nuget.targets file that had a ref to an older Forms package.  We deleted the file and it seems to be working so far.
Comment 12 Ton Snoei 2017-12-06 15:04:33 UTC
This problem does occur after I did the following:
1. Upgrade to Xamarin.Forms
2. Upgrade of VS Community to 15.5 (from 15.4)

The workaround for me was to downgrade xamarin.forms to

Please help us out here...
Comment 13 batmaci 2017-12-28 23:31:57 UTC
your advises just dont work. every single build, update brings back this annoying error. I just upgraded from latest 2.5 stable release on nightly build and getting this error. I downgraded back to 2.5, bump, getting error again. it is like virus. please remove that check you implemented to "avoid unexpected build errors", you just created bigger headache for us after 2.5 version
Comment 15 Jose Everaldo Araujo 2018-02-05 00:16:16 UTC
Error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly


I solved my problem by mounting the project (file-to-file) and compiling and was able to track the problem.

A solution library required the Microsoft.Bcl.Build package in the project that reference (the App in my case).

I just installed the package via nuget and everything ok ...

I hope this helps.
Comment 16 Derek Foulk 2018-02-15 21:19:17 UTC
We ran into this error after adding a reference to another project for debugging purposes (this project is normally referenced via NuGet package).

The error was caused by our Xamarin.Forms projects referencing Xamarin.Forms and the referenced library referencing

In a nutshell- we needed to consolidate the Xamarin.Forms references. This isn't required when you are referencing a Xamarin.Forms library via NuGet, but local references with different versions of Xamarin.Forms do not play well together.
Comment 17 Chris McBride 2018-04-14 02:20:20 UTC
Has there been any sort of traction on this issue?
We have two branches that we keep in sync. I recently did a diff between the branches, and there aren't any major differences.

Yet when I switch branches I sometimes get this GetTaskAbi error.
For example today, I did a build on one branch.
Then switched to the second branch, did a pull request. Merged the branch, committed, then switched back.
Then I switched to VS. I asked to reload the project as the file changed (the file should be the same, but the timestamp had been updated)
I reloaded the project. Made a one line change and did a build and got this error.

The only way to fix it, is to close VS, del the bin and obj directories, and restart.

It seems like the only way I can switch branches is to:
Do a clean all
Switch branch
[maybe restart visual studio]

Then I should be good. But you can't do a clean AFTER switch branches as you'll get this error,
Both of these branches are on the same Xamarin Forms. All but one of our projects are on the same Xamarin Form. One project isn't, but it isn't being built.

This is a very annoying error.