Following a Pluralsight course on OpenCV, I created a simple wrapper class in C++ and a consumer program in C#, all in the VS2022 IDE on Windows 11, using OpenCV 4.7.0. When I tried to call the dll from the C# program, the following exception occurred:
System.BadImageFormatException: ‘Could not load file or assembly ‘C++CLIWrapperToOpenCV, Version=1.0.8438.18274, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An attempt was made to load a program with an incorrect format.’
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
The DLL and the C~ program are targetted at X64.
Any help gratefully received.