1

I need to use Affdex SDK in a research project, but I am having problems starting the project with C#.

In Visual Studio I did the following steps:

  1. I created a new project;
  2. I added a reference to Affdex.dll.

However, when I try to instantiate a CameraDetector object, I have an exception with the message:

An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll

I know that my Affdex SDK is functional because I downloaded the sample project and it works perfectly. Furthermore, I used this project as base, I removed all sample classes, and I added my own classes and the project works appropriately. My conclusion is that I have to include another reference or configuration to the new project.

So, I would to know how is the step-by-step to create a new Visual Studio project to use the Affdex SDK.

paisanco
  • 4,098
  • 6
  • 27
  • 33

2 Answers2

3

This exception occurs since you did not reference the affdex-native.dll in your Visual Studio project. The .NET assembly depends on the affdex-native.dll and loads it in runtime. You can copy the affdex-native.dll as a reference to the output directory.

You can refer to the developer portal for using the C# SDK. We have a quick start guide for analyzing the camera feed.We have a couple of sample apps like AffdexMe and csharp-sample-apps which you can take a look at on github for quick reference.

0

Make sure you have referenced the correct dll. Usually, BadImage means that you have referenced the x64 dll to a x86 project. Make sure that your Platform, and the architecture of referenced dll, are same.

Best regards, Silviu.

Reporter
  • 3,897
  • 5
  • 33
  • 47
Lupu Silviu
  • 1,145
  • 11
  • 23