I have a .Net 4.5 WPF MVVM application I have added scanning support using the TWAINDotNet. All of the scanning features work fine until I build in Release and deploy. I confirmed that everything is getting built using the same .Net and "Any CPU" for the processor.
2020-04-03 16:06:33,169 [1] ERROR ScanningViewModel ScanningViewModel (null)
- ScanFromDevice An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) - at TwainDotNet.TwainNative.Twain32Native.DsmParent(Identity origin, IntPtr zeroPtr, DataGroup dg, DataArgumentType dat, Message msg, IntPtr& windowHandle) at TwainDotNet.DataSourceManager..ctor(Identity applicationId, IWindowsMessageHook messageHook) at TwainDotNet.Twain..ctor(IWindowsMessageHook messageHook) at TestMain.Scanning.ViewModels.ScanDocumentViewModel.get_objTwain() at TestMain.Scanning.ViewModels.ScanDocumentViewModel.ScanDocumentFromDevice() System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at TwainDotNet.TwainNative.Twain32Native.DsmParent(Identity origin, IntPtr zeroPtr, DataGroup dg, DataArgumentType dat, Message msg, IntPtr& windowHandle) at TwainDotNet.DataSourceManager..ctor(Identity applicationId, IWindowsMessageHook messageHook) at TwainDotNet.Twain..ctor(IWindowsMessageHook messageHook) at TestMain.Scanning.ViewModels.ScanDocumentViewModel.get_objTwain() at TestMain.Scanning.ViewModels.ScanDocumentViewModel.ScanDocumentFromDevice()
User contributions licensed under CC BY-SA 3.0