.net 该类型在两个DLL中都存在

vyu0f0g1  于 2023-11-20  发布在  .NET
关注(0)|答案(3)|浏览(291)

我想使用的东西从雅阁图书馆以及AForge图书馆.但当我安装它,我开始得到以下错误:

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

字符串
在这行代码中:

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


我怎样才能确保我只使用原始的AForge DLL呢?有没有变通的办法?
我试

  1. AForge.IntPoint


但事实证明,雅阁使用相同的名称空间.!

zwghvu4y

zwghvu4y1#

打开项目的References,右键单击违规者,然后选择Properties。


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



然后,每当你想在代码中使用你的违规引用时,只需在文件的顶部插入以下内容:

  1. extern alias MyAlias;

字符串

eivgtgni

eivgtgni2#

我通过检查Delete all existing files prior to publish

修复了此问题

lpwwtiir

lpwwtiir3#

这就是我的工作:
1-删 debugging 误信息中提到的引用。(尽管它显示了正确的版本,但只需删除它)。


的数据
2-从packages.config中删除相关行

  1. <package id="Microsoft.Owin.Security.Cookies" version="4.2.2" targetFramework="net48" />

字符串
3-从Nuget重新编译软件包或引用其dll。
4-确保它将旧版本Map到web.config中的新版本

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


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

展开查看全部

相关问题