Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Could not load file or assembly X or one of its dependencies.  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Posted on 2012-08-28
Medium Priority
Last Modified: 2012-09-18
Hi there,

I have a written a manged C++/CLI DLL wrapper around an unmanaged C++ shared library and I've referenced this DLL in a C# console application. Everything builds correctly.

This code had previously been running on Windows XP 32-bit. Now when I build everything with target type x64 on a Windows XP 64bit machine, I get the following exception at startup:

Could not load file or assembly X (the Managed Wrapper) or one of its dependencies.  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).

I've tried building with various settings: x86, mixed assemblies, win32, x64 but the application fails to run each time.

Why would I be getting this error about the assembly not being a valid win32 application when I'm building on XP 64bit with target type x64?

I'm working in Visual Studio 2010 on Windows XP 64bit. I'm also referencing libmysql.dll (both 32-bit/64-bit for different build targets).

Thanks in advance.
Question by:basil365
1 Comment
LVL 25

Accepted Solution

apeter earned 2000 total points
ID: 38345466
Does your unmanaged dlls are compatible with 64 bit though your wrapper is a 64 bit?

 Did you try the same setting with 32 bit machine and your wrapper works fine ?

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

578 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