1

I have a C++ main.dll with exported classes which is x86, a wrapper for it in C#/CLI which is x86 and has linked main.dll's lib and I have a C# Test.exe application that makes use of that wrapper (which is also set to 32bit in Properties -> Build -> Platform Target -> x86), I referenced it by simply right clicking on References -> Add Reference -> Test.Wrapper.Dll.

I've tried using Dependency Walker, everything looked correct except API-MS-WIN etc, but according to this post, that's normal.

I have C++ 2013, 2015, 2017 Redistributables installed.

Test.Wrapper.dll is also in the Test.exe's output folder.

I have no idea after this, any kind of help is appreciated.

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Test.Wrapper.dll' or one of its dependencies. The specified module could not be found at Test.Program.Main(String[] args)

Dave
  • 5,108
  • 16
  • 30
  • 40
thief
  • 11
  • 1
  • When are you getting this error, at runtime or when building – Jlalonde Feb 27 '19 at 18:41
  • I am getting this error at runtime. I also noticed that when building the C# Test.exe, this shows: `>------ Rebuild All started: Project: Test, Configuration: Debug Any CPU ------ ` the Debug Any CPU, however I already set it to x86 in Platform Target, eh. – thief Feb 27 '19 at 18:45
  • Can you add to your answer, the absolute path of the dll you're trying to target and what the path you're trying to use at runtime? – Jlalonde Feb 27 '19 at 18:48
  • `C:\Program Files (x86)\Test\Test\Debug\Test.Wrapper.dll` for both. I created a new project and targetted x86, same runtime error. – thief Feb 27 '19 at 19:08
  • 1
    So you haven't done anything to ensure that the unmanaged C++ DLL gets copied as well? Then that is what causes this problem. – Hans Passant Feb 28 '19 at 07:51

0 Answers0