0

I have just started a MAUI app project and for the Windows platform target, under Dependencies/net6.0-windows10.0.19041.0/Assemblies, I have added two DLLs. One of them is a c# managed assembly and it uses Interop services(DllImport) to import the other c++ native assembly. It seems like VS is having trouble finding that c++ native dll(The reference is invalid or unsupported), the native dll has a yellow triangle with an exclamation mark in it but the c# dll doesn't have it. Also when I try to run the MAUI app and call into the c# assembly, VS would complain by throwing a DLLNotFoundException for the native DLL.

What am I missing here?

  • Does this answer your question? [DllNotFoundException, but DLL is there](https://stackoverflow.com/questions/1246486/dllnotfoundexception-but-dll-is-there) – Ayoub Kaanich Aug 30 '22 at 19:31
  • @AyoubKaanich I don't think it helps, thank you though – peakpeaktan Aug 30 '22 at 20:01
  • Use dumpbin on the C++ DLL to figure out what DLL you are actually missing https://learn.microsoft.com/en-us/cpp/build/reference/dependents?view=msvc-170 – Ayoub Kaanich Aug 30 '22 at 20:05

1 Answers1

0

I ran into the same problem. I do not have a solution, but maybe you can verify that you have the same issue: If you provide a full absolute path for the DllImport() (exact location of the dll you would like to import), it finds it and can use it gracefuly. Reason for this is because deployed MAUI application for windows Directory.GetCurrentDirectory() method return c:\windows\system32.

Peet
  • 35
  • 1
  • 8