Home > Net >  C# ACR122U WPF Could not load file
C# ACR122U WPF Could not load file

Time:07-06

im working on a project in WPF where i need to read NFC / RFID Tags. I bought the ACR122U and tried to set it up, but whenever i start my application the error "System.BadImageFormatException: "Could not load file or assembly 'Sydesoft.NfcDevice.ACR122U, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'" and tells me it tried to load a file with the wrong format.

private static ACR122U acr122u = new ACR122U;

This line already crashes the application with said error.

I found this tutorial, which is for WinForms and therefore does not help much for my WPF application, but if i download and run the full project of this site and run it, everything works like a charm.

This Stackoverflow question seems to have potential but i do not understand the answer where i need to go to "Respective => Site Application Pool" and so on.

I would greatly appreciate any ideas on why it crashes for WPF but not for WinForms or any help that explains said answer to the Stackoverflow question. The following import is the one i use.

Sydesoft.NFCDevice;

CodePudding user response:

Turns out this error derives from my WPF-Application being 64-bit and the ACR122U library using 32-bit. Changing my application to 32-bit in Visual Studio solved the issue.

  • Related