I can't build my Xamarin Android project in Visual Studio 2017.
I keep getting this error:
Can not resolve reference: `System.Threading.Tasks.Extensions`, referenced by `MySqlConnector`. Please add a NuGet package or assembly reference for `System.Threading.Tasks.Extensions`, or remove the reference to `MySqlConnector`.
System.Threading.Tasks.Extensions is installed with NuGet. I need MySqlConnector.
I already cleaned the solution, cleaned all NuGet files, restarted Visual Studio, restarted my PC, reinstalled that NuGet package, reinstalled all NuGet packages, switched from Debug to Release and back, changed C# version, made sure all file permissions were correct on all NuGet files, referenced the System.Threading.Tasks.Extensions as dll, etc.
But the error just stays there. Any ideas what's wrong?
I believe you are using the System.Threading.Tasks.Extensions in the version of 4.5.1 or 4.5.2, you can try to uninstall the 4.5.1 or 4.5.2 and install version 4.5.0 in your Xamarin. Android project.
As of now (14-Jan-2019), It is a workaround before Xamarin solves the root cause of this issue in the newer version.
Dec2019 and installing 4.5.0 results in a "java.exe existed with a code 2" failure to build.
Going to try hand editing the android project file as described here: https://forums.xamarin.com/discussion/134422/could-not-load-assembly-system-threading-tasks-extensions
<ItemGroup> <PackageReference Include="System.Reactive" Version="4.1.1" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2"/> </ItemGroup> <ItemGroup> <Reference Include="System.Threading.Tasks.Extensions"> <HintPath>$(UserProfile)\.nuget\packages\system.threading.tasks.extensions\4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath> </Reference> </ItemGroup>
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