Xamarin Android 将无法编译:已导入多个具有等效标识的程序集 [英] Xamarin Android will not compile: Multiple assemblies with equivalent identity have been imported

查看:22
本文介绍了Xamarin Android 将无法编译:已导入多个具有等效标识的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在下面看到错误.

You can see the error below.

System.Runtime.InteropServices.WindowsRuntime

我的项目包中安装了一个版本,Mono 框架需要另一个版本.我觉得 Mono 框架应该是赢家.我的 iOS 版本不会发生此错误.

One version is installed in my project's packages, and another one is needed for the Mono framework. I feel like the Mono Framework should probably be the one that wins. This error does not happen on my iOS builds.

我该如何告诉 Visual Studio 社区 (Mac) 不要引用有问题的 dll?

How would I go about telling Visual Studio Community (Mac) not to reference the offending dll?

/myproject/path/MyApp.Droid/CSC: 
Error CS1703: Multiple assemblies with equivalent identity have been imported: 
'/myproject/path/packages/System.Runtime.InteropServices.WindowsRuntime.4.0.1/lib/netstandard1.3/System.Runtime.InteropServices.WindowsRuntime.dll' and 
'/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.InteropServices.WindowsRuntime.dll'. 
Remove one of the duplicate references. (CS1703) (MyApp.Droid)

推荐答案

就在本周遇到了这个问题.不知道是什么变化导致的.

Ran into this just this week. No idea what change caused it.

对我有用的是在 .csproj 参考中注释掉 HintPath:

What worked for me was commenting out the HintPath in the .csproj Reference:

<Reference Include="System.Runtime.InteropServices.WindowsRuntime">
    <!--HintPath>..\..\packages\System.Runtime.InteropServices.WindowsRuntime.4.0.1\lib\netstandard1.3\System.Runtime.InteropServices.WindowsRuntime.dll</HintPath-->
    <Private>True</Private>
</Reference>

重复问题这里,顺便说一句.

Duplicate question here, btw.

这篇关于Xamarin Android 将无法编译:已导入多个具有等效标识的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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