ssmsexe
ssmsexe

Reputation: 221

Could not load assembly Microsoft.Threading.Tasks.dll

I am receiving the following error on iOS and Android project. Anybody has any workaround for this issue? This post recommends a workaround but the steps are vague.

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Microsoft.Threading.Tasks.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Braemar.Vers.Mobile.Droid)

I think that these two paths should have this file but I couldn't find it.

Xamarin Studio: Version 5.10.2 (build 56) Installation UUID: 88f72eda-5030-43e9-8d1b-7658e8a17627

Runtime: Microsoft .NET 4.0.30319.42000 GTK+ 2.24.23 (MS-Windows theme) GTK# 2.12.30

Xamarin.Android: Version: 6.0.1.10 (Business Edition) Android SDK: C:\Android\android-sdk Supported Android versions: 2.3 (API level 10) 4.0.3 (API level 15) 4.1 (API level 16) 4.2 (API level 17) 4.3 (API level 18) 4.4 (API level 19) 4.4.87 (API level 20) 5.0 (API level 21) 5.1 (API level 22) 6.0 (API level 23)

SDK Tools Version: 24.4.1 SDK Platform Tools Version: 23.1.0 rc1 SDK Build Tools Version: 23.0.2

Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71 java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

Build Information: Release ID: 510020056 Git revision: bb74ff467c62ded42b7b7ac7fdd2edc60f8647b0 Build date: 2016-01-26 15:49:39-05 Xamarin addins: 8b797d7ba24d5abab226c2cf9fda77f666263f1b Build lane: monodevelop-windows-cycle6-c6sr1

Operating System: Windows 10.0.10586.0 (64-bit)

Project Information: PCL 4.5 - Profile 7

Upvotes: 2

Views: 2334

Answers (3)

raV720
raV720

Reputation: 594

I had such problem. It was caused by missing nuget packages in Droid project. Some of my subprojects referenced packages which had "Microsoft.Threading.Tasks" in references (PCLStorage, Restsharp portable). But in main Droid project I did not added this packages. After adding missing packages (PCLStorage, Restsharp portable) to Droid everything started work.

Upvotes: 1

latsson
latsson

Reputation: 670

I had the same problem.

  1. Right click and select Options for the Android project.
  2. Go to Build->General and uncheck "Use MSBuild build engine (recommended for this project type)"

Now I could build again!

Upvotes: 0

Adam
Adam

Reputation: 16199

Is there any reason you are using Profile7?

I would recommend you create a project with profile 259, that is the default one for Xamarin Forms projects.

Otherwise you need to get a reference to that DLL. Normally I try installing the BCL NuGet package as my first port of call, but it might not be included in there: https://www.nuget.org/packages/Microsoft.Bcl/

Update

If you are having linker issues, you can skip certain assemblies: https://developer.xamarin.com/guides/ios/advanced_topics/linker/#Skipping_Assemblies

Sometimes the linker is more aggressive than anticipated.

Upvotes: 0

Related Questions