Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

It's my first issue here.

I have a SLN with the the settings as follows:
- IDE: Visual Studio 2012 - Windows Server 2008 R2 Datacenter.
- A couple of C++/CLI DLL projects called DF and FT with plataform toolset v100 (Visual Studio 2010 compiled) and /clr support that contains my legacy code.
- A Asp.Net MVC 4.0 DLL web project called RW that integrates with above projects availabling on the web.

Remarks:
- All projects has the same path output: C:\projectsOut\;
- The C:\projectsOut\ is configured in enviroment variable PATH;
- There is no compilation problem;
- RW dll have FT and DF dll dependencies;
- FT dll have DF dll dependency;
- The tree projects has SNK files (signature);
- I has changed the DEP (data execution prevention) configuration only to the essentials Windows applications;
- The configurations of DF and FT projects were changed: Properties > Linker > Manifest File > Generate Manifest > Yes and Properties > Manifest Tool > Input and Output > Embed Manifest > No.

But when I run my project in debug mode, an BadImageFormatException occurs. The description is something like that (I have translated from portuguese):
Quote:
Fail to load file or assembly 'FT.DLL' or dependencies. Access violation. (Exception HRESULT: 0x800703E6)

Details: System.BadImageFormatException: Fail to load file or assembly 'FT.DLL' or dependencies. Access violation. (Exception HRESULT: 0x800703E6)


What is wrong with my application? I think it's a security configuration, but I don't know what.

My best regards.
Posted
Updated 5-Jul-13 3:26am
v5

This error usually occurs when you've referenced an x86 DLL in an AnyCPU/x64 running on x64, or vice versa. Make sure that the referenced DLL's are compiled under the same architecture that the project is.
 
Share this answer
 
Comments
Hains Hausmann Junior 5-Jul-13 9:41am    
Hi Ron Beyer, the C++/CLI DF and FT solutions are compiled under Win32 plataform.
the MVC RW solution is compiled under x86.
My Windows is x64, but I can't compile my legacy code (DF and FT) under x64 because they aren't able.
Ron Beyer 5-Jul-13 9:51am    
Just make sure that your legacy code is in the same architecture as you are compiling on. If the legacy is x86, set your project to compile under x86 (not AnyCPU).
Hains Hausmann Junior 5-Jul-13 10:42am    
Looking C++/CLI project's properties, I found Linker > Advanced > Target Machine : MachineX86.
I think it's ok.
The problem was relationed with header include.
When I changed some includes, the app had worked normally.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900