该类型存在于两个 DLL 中

问题描述 投票:0回答:3

我想使用 Accord 库和 AForge 库中的一些东西。但是当我安装它时,我开始收到以下错误:

Error CS0433
The type 'IntPoint' exists in both
    'AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' and
    'Accord, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7'

在这行代码上:

startingPoint = new IntPoint(point.X, point.Y);

如何确保我只使用原始的 AForge DLL?也许有解决方法吗?

我试过了

AForge.IntPoint

但事实证明,Accord 使用相同的命名空间......!

.net dll nuget aforge accord.net
3个回答
15
投票

打开项目的

References
,右键单击违规者,然后选择属性。

将您的别名更改为自定义名称:

然后,每当您希望在代码中使用有问题的引用时,只需将其插入文件顶部即可:

extern alias MyAlias;

0
投票

我通过检查修复了这个问题

Delete all existing files prior to publish


0
投票

我只需转到项目的引用并删除错误消息中提到的引用即可。 (虽然它显示的是正确的版本,但删除它即可)。

您还需要确保它将旧版本映射到 web.config 中的新版本

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
  </dependentAssembly>

那里是正确的,但有时它会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.