Solved

I'm getting "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

Posted on 2011-09-12
2
312 Views
Last Modified: 2013-12-17
hi -- I've recently tried to port my 32bit application to a windows 7 64 bit target. my development environment is on a 32 bit Vista system. after thrashing around with some other problems, this is the latest error i get. I think the error is coming from a dll that was written in c and compiled under an older version of VS. I use a p/invoke interface to unmanaged code to use it (it's a driver for a usb device.) I would rather not have to sort out whether i have the source code, etc for the dll. is there a "simple" way around this? I'm also using some assemblies from National Instrument that will not run without using their 64 bit merge modules, so the installer needs to declare it a 64 bit app.
I tried using CorFlags but it expects assemblies, not unmanaged code.
I'm using .net 4.0 and vs 2010.
thanks.
0
Comment
Question by:jdcoburn
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 36527500
My understanding is that a .net program will run as 32 bit on a 32 bit machine and 64 bit on a 64 bit machine without you having to do anything.
This sounds like on the 64 bit machine there is then problems trying to use 32 bit dll's.

There should be a setting in the solution (project) properties that will force the .net environment to always use 32 bit .net code even on a 64 bit machine.  That may well be the solution for you.
0
 

Author Closing Comment

by:jdcoburn
ID: 36554178
hi -- the situation was more complicated. i eventually had to recompile a dll that linked to my app, plus pull through some other dll's that were 64bit only. anyway the solution got me started along an eventually successful path.
thanks,
Jim
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now