Error: An unhandled exception of type "System.BadImageFormatException" occurred in System.Windows.Forms.dll

New error popped up when I created new build configuration for x86Target not setting to x86 I am trying to capture frames from a video stream, and I am trying to use the AForge library for this purpose. But when I try to call any of the library APIs from my project, it gives me the above error.

My research shows that this may be due to the use of a 32-bit x64 dll window library or vice versa. But I could not find any AForge library package for 64-bit windows. I am using x64 windows7. Any links or suggestions that may help me resolve this error will be truly appreciated. enter image description here

+6
source share
2 answers

I would like to thank everyone for their kontrub ... The steps taken solved the problem ... This link worked

A new solution is created. Existing projects are added. Simply place the appropriate configuration file next to your exe and fill it out:

<?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> 

Can help someone ...

+4
source

I changed the target platform to x86 and my program runs successfully on x86 and x64 systems. Thank you all for your help. I changed the target platform to x86 and my program runs successfully on x86 and x64 systems More details. I have 5 projects in solution. Two projects using framework 2.0 are the base classes and another project and exe project using framework 4.0. Something has changed in the base project and in the correct construction of the solution, but it does not work. The latest issue of the project turned two years old. I made a new release, but it is running. I was happy to quickly fix it with the goal of changing the project to x86. But we did not find the cause of this problem.

+5
source

Source: https://habr.com/ru/post/987020/


All Articles