0

I have .NET 5 project which includes C++/CLI DLL, which includes C++ DLL, which includes opencascade DLLs. All these projects are built for the x64 platform. I've published this solution to my local folder and then set up IIS server everything works fine. But when I've tried to upload my project to two different hostings (https://www.smarterasp.net/ and azure) I've got this error. Project crashes when it starts use C++/CLI dll(using namespace C++/CLI). I've also set up x64 platform in azure portal.

enter image description here

I would appreciate any help.

m4n0
  • 29,823
  • 27
  • 76
  • 89
  • 1
    One possible cause of this error is a missing DLL. To check, Run your app. Get the error. Go to the Windows Event Viewer (Start Menu and type "Event"). In the EventViewer, under Windows Logs >> Application, you might see an error message regarding the failure. If the error is a missing DLL, it will typically tell you the name of the DLL as well – Joe Sep 16 '21 at 21:56
  • Thank you @Joe for your answer, appreciate it, but it didn't help. I've solved my issue by moving my project to another enviroment. – Artem Mishenkov Oct 01 '21 at 23:15
  • Hi @ArtemMishenkov, we're facing this issue. Can you clarify what you mean by "moved my project to another environment" ? – Anthony Oct 10 '21 at 23:56
  • Hi @Anthony, I've set up a server on my local machine because there I don't get any errors. But it is a temporary solution. Now I'm trying to replace C++/CLI with P/Invoke but still no success. – Artem Mishenkov Oct 12 '21 at 13:16
  • Hi @Anthony, I've fixed this issue. It appeared that my project was missing some system DLLs(kernel32, kernelbase etc.), so I have added them to the project and it works fine. – Artem Mishenkov Oct 14 '21 at 16:26
  • Hi @ArtemMishenkov, Thanks for letting me know. Because our C++/CLI projects only contained managed code, I ended up translating our C++/CLI projects to C# to get us passed all the issues we were having. – Anthony Oct 31 '21 at 21:11

1 Answers1

1

Thank you Joe. Posting your suggestion as an answer to help other community members.

Project crashes because of missing DLL. Run the app and get the error.

Go to the Windows Event Viewer (Start Menu and type "Event"). In the EventViewer, under Windows Logs >> Application, you might see an error message regarding the failure. If the error is a missing DLL, it will typically tell you the name of the DLL as well.

You can refer to Could not load file or assembly ... An attempt was made to load a program with an incorrect format (System.BadImageFormatException), Troubleshooting BadImageFormatException and System.BadImageFormatException An attempt was made to load a program with an incorrect format

Ecstasy
  • 1,866
  • 1
  • 9
  • 17