Sapna
Sapna

Reputation: 71

Unable to load the Managed C++ dll into C# Dll

I have a C# application which is built with platform target as ANY CPU. It references a managed C++ application which is built with the platform target as Win32. However the loading of the C++ dll fails at runtime with the following error. "Could not load file or assembly 'abc_Debug, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to access invalid address. (Exception from HRESULT: 0x800701E7)"

Can anyone give me some pointers as to what could be wrong?

Upvotes: 1

Views: 3196

Answers (2)

DesignFirst
DesignFirst

Reputation: 329

in general for any loading problem of managed dlls, it's better to use fuslogvw it can gives you more details.

Upvotes: 0

Ignacio Soler Garcia
Ignacio Soler Garcia

Reputation: 21855

If you are running the application at a x64 architecture then your app is starting as x64 and then it can't load the c++ reference. You cannot build an application as AnyCpu if you don't have all the dependences available for AnyCpu, otherwise set x86 as the target.

Upvotes: 1

Related Questions