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
314 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
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…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

815 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

12 Experts available now in Live!

Get 1:1 Help Now