2
votes

I am trying to build a Xamarin.iOS(runtime v4.0.30319) project but keep getting the following error

Severity Code Description Project File Line Suppression State Error Can not resolve reference: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Threading.Tasks.Extensions.dll myApp.iOS C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 795

When I look in C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades I can see System.Threading.Tasks.Extensions.dll exists.

and when I compare Xamarin.iOS.Common.targets on another machine that works, there are no differences

after extensive searching I have not been able find a solution. I have also tried:

  • manually adding the .dll to the iOS project
  • reinstalling the .netstandard framework which is used
  • deleting the solution and pulling from source control (I'm the only one affected by this issue)
  • compared my set up to other working set ups

Extra information (possibly irrelevant): This is a cross platform solution and when built in the android environment, everything works as expected.

3
Because this error is provocated by many types of error or inconsistencies try all this steps, 1) delete de bin/obj folder in your project 2) delete the app of the simulator 3) change the simulator device, 4) close visual studio, 5) open again, 6)restore the nuget packages 7) clean and rebuild let me know if this solved your problem. - Marcos José Pérez Pérez

3 Answers

2
votes

This issue was caused by a versioning mismatch.

I was running developing in on my windows machine and deploying to an iOS device via a mac on my local network.

The iOS version held on the mac differed from the version in my xamarin iOS project (the mac had been updated by another dev).

The resolution for me was to make sure both versions were the same

2
votes

I too had a similar problem but there was no System.Threading.Tasks.Extensions.dll on the Mac in the /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades folder. However on the Windows PC, this file exists in the C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades folder.

The solution for me was to copy the System.Threading.Tasks.Extensions.dll file from the Windows PC to the Mac.

2
votes

I ran into this issue as well. My solution was to launch Visual Studio on the Mac (in my case a Mac Mini) and grab all updates for Visual Studio. One of the updates specifically mentioned the System.Threading.Tasks.Extensions.dll issue that I had been experiencing. After the updates I was able to build the project.

Release note of Visual Studio 15.9.4 : "Error MT2002: Failed to resolve 'System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder' reference from 'System.Threading.Tasks.Extensions...'" when building a Xamarin.iOS project." https://docs.microsoft.com/fr-fr/visualstudio/releasenotes/vs2017-relnotes#-visual-studio-2017-version-1594visual-studio-2017-version-1594-