473,563 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BadImageFormatE xception was unhandled

VS2005 ( all updates ) on XP ( all updates )

I have a solution with many projects and a substantial reference tree.

I have a Windows Application project that will build but not run. It fails
in Program.cs when it attempts to invoke the form class :

Application.Run ( new Form1() );
BadImageFormatE xception was unhandled

Could not load file or assembly 'MyApi, Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken= null' or one of its dependencies. An attempt was made to load
a program with an incorrect format.
The strange thing is that other Windows Applications that contain a
reference to the MyApi assembly run just fine.

I clean and rebuild to no avail. Also, removing/adding ref does not help.

What could be going on ?
Sep 23 '08 #1
3 5248


"John A Grandy" wrote:
VS2005 ( all updates ) on XP ( all updates )

I have a solution with many projects and a substantial reference tree.

I have a Windows Application project that will build but not run. It fails
in Program.cs when it attempts to invoke the form class :

Application.Run ( new Form1() );
BadImageFormatE xception was unhandled

Could not load file or assembly 'MyApi, Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken= null' or one of its dependencies. An attempt was made to load
a program with an incorrect format.
The strange thing is that other Windows Applications that contain a
reference to the MyApi assembly run just fine.

I clean and rebuild to no avail. Also, removing/adding ref does not help.

What could be going on ?
Hi john,
I think the problem is in your image which is you trying to open, try to
open different image file.
Sep 23 '08 #2
No this has nothing to do with image ( .img ) files. I am not working with
any images.
"Atul Rane" <At******@discu ssions.microsof t.comwrote in message
news:F5******** *************** ***********@mic rosoft.com...
>

"John A Grandy" wrote:
>VS2005 ( all updates ) on XP ( all updates )

I have a solution with many projects and a substantial reference tree.

I have a Windows Application project that will build but not run. It
fails
in Program.cs when it attempts to invoke the form class :

Application.Ru n( new Form1() );
BadImageFormat Exception was unhandled

Could not load file or assembly 'MyApi, Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken =null' or one of its dependencies. An attempt was made to
load
a program with an incorrect format.
The strange thing is that other Windows Applications that contain a
reference to the MyApi assembly run just fine.

I clean and rebuild to no avail. Also, removing/adding ref does not
help.

What could be going on ?
Hi john,
I think the problem is in your image which is you trying to open, try to
open different image file.

Sep 23 '08 #3
John A Grandy wrote:
No this has nothing to do with image ( .img ) files. I am not working with
any images.
"Atul Rane" <At******@discu ssions.microsof t.comwrote in message
news:F5******** *************** ***********@mic rosoft.com...
>>
"John A Grandy" wrote:
>>VS2005 ( all updates ) on XP ( all updates )

I have a solution with many projects and a substantial reference tree.

I have a Windows Application project that will build but not run. It
fails
in Program.cs when it attempts to invoke the form class :

Application.R un( new Form1() );
BadImageForma tException was unhandled

Could not load file or assembly 'MyApi, Version=1.0.0.0 , Culture=neutral ,
PublicKeyToke n=null' or one of its dependencies. An attempt was made to
load
a program with an incorrect format.
The strange thing is that other Windows Applications that contain a
reference to the MyApi assembly run just fine.

I clean and rebuild to no avail. Also, removing/adding ref does not
help.

What could be going on ?
Hi john,
I think the problem is in your image which is you trying to open, try to
open different image file.


In general, this exception happens when a dependent is not correct in
the current OS platform.

For example, in 64 bit OS, a dotnet2 app loads a native 32bit DLL. (64
bit app cannot load 32 bit DLL).

Since, no info about what is the platform the problem happens, cannot
confirm is this case.

Note about that, for dotnet2 app, the will run as 64 bit app in 64 bit
OS, except the developer directly mark it is 32bit only. Otherwise, the
64 bit main exe cannot load any 32bit DLL, include the DLL which uses
managed C++ and it calls the win API, or other natvie C 32bit DLL.

--
Jacky Kwok
jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk
Sep 24 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
413
by: Erich Hofacker | last post by:
Hello, I have written an application in .NET (C#) which uses some stuff from the Microsoft.mshtml. Unfortunately some customers reported that they are missing this DLL. Therefore we now redistribute a copy of the Microsoft.mshtml-DLL with our installation routine (just copy it into the application directory). Now the application works on...
3
14894
by: Madhu Gopinathan | last post by:
Hi, I am facing a problem in .NET COM InterOp. I have a COM Dll which I want to use from my CSharp code. So, I import the TLB directly from the DLL using the tlbimp tool to a managed DLL. I add a reference to this managed DLL in my CSharp solution. Now, when I try to create a new instance of an object inherent in the COM DLL using MyObject...
3
11939
by: Installutil System.BadImageFormatExcepti | last post by:
I've tried to make a Windows Service using the 2005 C# and when I go to use Installutil it returns with an System.BadImageFormatException error while intializing the installation. I've even gone as far as creating a service with 2003 C# that Installutil works with with then I try to upgrade the 2003 project to 2005 and then I start getting the...
1
6709
by: cwjacklin | last post by:
I read this article on http://msdn.microsoft.com/msdnmag/issues/03/07/NET/ which describes how to invoke C win32 dll from C# But I am running into a weird situation. I have an existing C win32 dll which I want to call from C#. When I use syntax like this
4
4475
by: Roger Aikin | last post by:
I've converted a VB6 project to VB.Net 2005. (Actually using vstudio pro 2005). I'm on a machine that also has VB6 and Vstudio.net 2003 on it. The project uses Word, Excel, MapPoint and SqlClient (database is SqlServer 2000). OS is WinXP SP2. When I run the project, it opens the MDI form (MdiMain.vb) fine, but when I open one of the...
1
1513
by: notis | last post by:
Hi all, I am trying to port an application developed with VS2003 to VS2005. The project builds successfuly but when I run it, it throws a BadImageFormatException in the following line of code in the constructor of my main form : .... if (!System.Messaging.MessageQueue.Exists(@".\Private$\CentralInQueue"))
3
1706
by: notis.stamos | last post by:
Hi all, I am trying to port an application developed with VS2003 to VS2005. The project builds successfuly but when I run it, it throws a BadImageFormatException in the following line of code in the constructor of my main form : .... if (!System.Messaging.MessageQueue.Exists(@".\Private$\CentralInQueue"))
1
1850
by: nate | last post by:
hi :) i am having a strange problem. i have a plug-in system that i use to add support for various CAD file formats. i have a Maya plug-in that i have been running successfully for quite some time (i.e. months). a couple of days ago, however, i started getting a BadImageFormatException when i tried loading my managed mayaplug.dll. The...
4
9283
by: Glenn Palomar | last post by:
Hi, I have VB.net application that I recently migrated from VS2003 to VS2005. It works fine in Windows XP and 2K but NOT in XP64. I get an exception error that says System.BadImageFormatException. I checked the Advanced Compliler Settings and the Target CPU is set to AnyCPU. Setting it x64 does not make a difference. If I run my...
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.