VS2005 BadImageFormatException msmq

N

notis.stamos

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"))
....

The exception window title is:
BadImageFormatException was unhandled.

The exception message is:
An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)

The version of the application that was compiled using VS2003 still
runs on the same computer.

I am using VS2005 - Version 8.0.50727.42 and .NET version 2.0.50727.

Any help would be greatly appreciated.

Thanks,
Notis.
 
N

notis

OK, after some experimenting I found out that the problem is caused due
to a comon reference of System.Messaging. More specifically:

I have a solution with several projects. One of them is lets say my
application project. Another is a library project with several user
controls in it. Both projects reference System.Messaging.

My library project is referenced by the application project.

When I try to run the application project I get the previously
described exception. If I stop referencing the library project (or I
take out the reference to System.Messaging from the library project)
then the application project runs.
Of course this is only possible for experimentation as I need to
reference the library project in real life.

It seems that VS2005 doesn't like System.Messaging to be referenced
both by the library and by the application project. This used to be no
problem with VS2003.

Any ideas why this is happening and how to get around it?

Thanks,
Notis.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top