Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error MT2001: Could not link assemblies. Reason: Error while processing references

I'm getting this error trying to build a Xamarin.iOS project referencing a .NET Standard 2.0 library.

None of the MT2001 issues online seem to have this specific "Error while processing references" reason, so I'm at a loss as to how to diagnose this. I've tweaked and fiddled about as much as any one person can and stay sane, but I'm really in the dark.

Can anyone out there point me in a direction?

like image 722
Adrian Frielinghaus Avatar asked Jul 21 '18 15:07

Adrian Frielinghaus


1 Answers

Adding -v -v -v -v to "Additional mtouch arguments" in the project iOS Build settings will help diagnose the issue. After that, you can search the build output for MT2001 and view the inner exceptions. Obviously, each project may differ as to what assembly causes the linker to fail. You may need to add, remove or fix your references based on the output.

For example, I was trying to use SignalR from AspNetCore 2.1, which has a dependency on System.Threading.Tasks.Extensions 4.5.1 in my project, which it seems Mono does not yet support. Mono does not provide its own version of the assembly yet, so when mtouch goes to link the assembly, it's unable to do so and throws an exception:

Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

Removing all references to this assembly (and therefore the whole feauture in my case) allowed the build and linking to succeed.

like image 150
Brandon Rader Avatar answered Oct 08 '22 00:10

Brandon Rader