Home All Groups Group Topic Archive Search About

an attempt was made to load a program with an incorrect format

Author
21 May 2010 11:17 PM
Scott Baxter
Hello,

This is the error I get on Windows 7.

I tried going to the project screen in vb.net Studio 2008, and changing the
target cpu to x64.  This did not work.

Do I have to build the program on Windows 7?


I'm sure this must be a common problem for programs going to Windows 7.

Thanks for any help.

Scott

Author
21 May 2010 11:41 PM
Onur_Güzel
Show quote Hide quote
On May 22, 2:17 am, "Scott Baxter" <sc***@websearchstore.com> wrote:
> Hello,
>
> This is the error I get on Windows 7.
>
> I tried going to the project screen in vb.net Studio 2008, and changing the
> target cpu to x64.  This did not work.
>
> Do I have to build the program on Windows 7?
>
> I'm sure this must be a common problem for programs going to Windows 7.
>
> Thanks for any help.
>
> Scott

Hi,

I think you need to set target CPU to x86 explicty and re-compile,
then try to run on Win 7 x64:

http://i.msdn.microsoft.com/Bb398791.DropdownBox_VBWAP(en-us,VS.100).png

or try to use corflags utility:
http://blogs.msdn.com/arvindsh/archive/2009/06/21/tip-of-the-day-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-net-p-invoke-issue.aspx

HTH,

Onur Güzel
Author
22 May 2010 12:00 AM
Mr. Arnold
Scott Baxter wrote:
Show quoteHide quote
> Hello,
>
> This is the error I get on Windows 7.
>
> I tried going to the project screen in vb.net Studio 2008, and changing
> the target cpu to x64.  This did not work.
>
> Do I have to build the program on Windows 7?
>
>
> I'm sure this must be a common problem for programs going to Windows 7.
>
> Thanks for any help.


The rule of thumb I always follow is develop, compile and build the
application on the platform it's intended to run on. That means you
develop, compile, and build the application on Win 7 64 machine to be
deployed to a Win 7 64 machines -- Windows XP machine to Windows XP
machines, Vista machine to Vista machines, etc. etc.
Author
7 Jun 2010 6:06 PM
D-Someone
This is unrealistic.


Show quoteHide quote
"Mr. Arnold" wrote:

> The rule of thumb I always follow is develop, compile and build the
> application on the platform it's intended to run on. That means you
> develop, compile, and build the application on Win 7 64 machine to be
> deployed to a Win 7 64 machines -- Windows XP machine to Windows XP
> machines, Vista machine to Vista machines, etc. etc.
> .
>
Author
8 Jun 2010 8:51 AM
Cor Ligthert[MVP]
Not that much.

However, it is impossible to develop a Windows 7 application on Windows 98

While you still can make Windows 98 applications on Windows 7

Cor

Show quoteHide quote
"D-Someone" <DSome***@discussions.microsoft.com> wrote in message
news:9B60EF67-012F-4B7C-98D3-1A751125ABB2@microsoft.com...
>
> This is unrealistic.
>
>
> "Mr. Arnold" wrote:
>
>> The rule of thumb I always follow is develop, compile and build the
>> application on the platform it's intended to run on. That means you
>> develop, compile, and build the application on Win 7 64 machine to be
>> deployed to a Win 7 64 machines -- Windows XP machine to Windows XP
>> machines, Vista machine to Vista machines, etc. etc.
>> .
>>
>
Author
8 Jun 2010 9:56 AM
Willem van Rumpt
Cor Ligthert[MVP] wrote:
> Not that much.
>
> However, it is impossible to develop a Windows 7 application on Windows 98
>
> While you still can make Windows 98 applications on Windows 7
>
> Cor
>

Hmmm...i'd love to see that in a development process...maintaining about
a dozen codebases and distributables. And what if a customer upgrades /
downgrades to a different OS?

Test on the expected range of OS's, absolutely. But build and develop
per OS?

--
Willem van Rumpt
Author
25 May 2010 1:32 AM
Herfried K. Wagner [MVP]
Am 22.05.2010 01:17, schrieb Scott Baxter:
> This is the error I get on Windows 7.
>
> I tried going to the project screen in vb.net Studio 2008, and changing
> the target cpu to x64. This did not work.
>
> Do I have to build the program on Windows 7?

Are you sure the Windows 7 version of the PC you are trying to run the
application on is the 64-bit version and not the 32-bit (x86) version?

--
  M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>