11

I wanted to use something from Accord library as well as the AForge library. But when I installed it, I started getting the following error:

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'

On this line of code:

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

How can I ensure that I only use the original AForge DLL for this? Is there perhaps a workaround?

I tried

AForge.IntPoint

but as it turns out, Accord uses the same namespace...!

Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135
  • 1
    Looks like Accord.Net copied the AForge source code instead of using a reference. Sloppy. So you need to remove the AForge reference from your project, ought to be simpler than battling *extern alias*. – Hans Passant Apr 23 '16 at 07:43
  • @HansPassant Unfortunately, I need stuff from `AForge.Imaging`, which relies upon `AForge`. As soon as I remove the reference to `AForge`, it still tells me I need to add a reference to `AForge`. – Mateen Ulhaq Apr 25 '16 at 16:09
  • Just as a clarification: Accord.NET did not sloppily copy the AForge.NET source code instead of using a reference, it _effectively replaced AForge.NET because AForge.NET had been discontinued_. For a while Accord.NET was offering the same content as AForge with the same namespace so it could behave as a drop-in replacement for existing projects. – Cesar Jul 08 '17 at 17:20

2 Answers2

15

Open up your project's References, right-click on the offender, and select Properties.

enter image description here

Change your Aliases to a custom name:

enter image description here

Then whenever you wish to use your offending reference in your code, simply insert this at the top of your file:

extern alias MyAlias;
Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135
  • 1
    All code from *AForge.Imaging* has been fully included in *Accord.Imaging* starting from Accord 3.0, so there should be no need for you to reference *AForge.Imaging*. – Anders Gustafsson Apr 25 '16 at 17:49
0

I fixed this by checking Delete all existing files prior to publish enter image description here

sojim2
  • 1,245
  • 2
  • 15
  • 38