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
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

    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 ?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now