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
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

730 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