For anyone who may arrive here at a later time...
For Desktop solution I got BadImageFormatException
exception.
All project's build options was fine (all x86
). But StartUp project of solution was changed to some other project(class library project).
Changing StartUp project to the original(.exe application project) was a solution in my case