错误MT2001:无法链接程序集.原因:处理参考时出错 [英] Error MT2001: Could not link assemblies. Reason: Error while processing references

查看:198
本文介绍了错误MT2001:无法链接程序集.原因:处理参考时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试构建引用.NET Standard 2.0库的Xamarin.iOS项目时遇到此错误.

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

在线发布的MT2001似乎都没有这个特定的处理引用时出错"的原因,因此我对如何诊断这一点感到迷惑.我已经尽我所能地调整和摆弄任何人,并保持理智,但是我真的在黑暗中.

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?

推荐答案

在项目iOS Build设置的其他mtouch参数"中添加-v -v -v -v将有助于诊断问题.之后,您可以在构建输出中搜索MT2001并查看内部异常.显然,每个项目可能在导致链接器失败的程序集方面有所不同.您可能需要根据输出添加,删除或修复引用.

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.

例如,我尝试使用来自AspNetCore 2.1的SignalR,该程序在我的项目中依赖于System.Threading.Tasks.Extensions 4.5.1,似乎

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.

这篇关于错误MT2001:无法链接程序集.原因:处理参考时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆