How to: Use AForge.NET libraries in your project

AForge.Net is one of the most beautiful libraries for several purposes like motion detection or image processing.

You can reach the further information from here.

But the thing is, how can you use these references in your project?

Let’s jump in;

  • First, download the libraries (.dll files) from the link that I mentioned above.
  • If you would like to carry those libraries with your project, copy the libraries that you use into the application folder.
  • Add those libraries to your project as references.
  • Build your project, and use the namespaces, classes and methods from the AForge.NET.

After this part, you may get errors from your application. Here are the possible reasons and solutions;

  • Compile Error: You are not compiling your project in x86 mode:
    • Most of AForge.NET libraries are built for applications run with x86 assembly. So, you have to rebuild your application in x86 architecture.
  • Missing Reference Error: Some AForge.NET libraries (like AForge.Video.FFMpeg) are dependent some other references.
    • You can find the missing references into the AForge.NET Externals folders after you install or download the complete version of the AForge.NET. (Possible path: C:\Program Files (x86)\AForge.NET\Framework\Externals).
    • Let’s assume that we are trying to use ffmpeg library, you have to copy all .dll files from related path (probably something  like: C:\Program Files (x86)\AForge.NET\Framework\Externals\ffmpeg\bin), to your projects bin folder.
    • Rebuild and run your project again.
    • The problem must be resolved.

Hope this helps.