I have a web app on Azure. It uses .NET Core 3.1. I use two C++ DLL files as dependencies in the app. The first DLL depends or uses the second DLL. When I run the project in Visual Studio locally, there is no issue. When I deploy the app to Azure, it complains only from the second DLL, and it says "unable to load dll or one of its dependencies". As I said the first DLL use the second DLL in its codes by using " [DllImport(@"..\Folder\Second.dll")] ". What do I need to do or add in web app? Why it is working locally anf not on Azure? Any help would be appreciate.
Asked
Active
Viewed 463 times
1
-
1Probably you didn't publish the DLL to Azure... but since you didn't provide any diagnostic info, we can't help you. – Ian Kemp May 04 '21 at 16:32
-
Following lan Kemp's suggestion, first copy your dll file to the specified path. (Through kudu, open the scm website). – Jason Pan May 05 '21 at 01:13
-
If my reply is helpful, please accept it as answer(click on the mark option beside the reply to toggle it from greyed out to fill in.), see https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Jason Pan May 05 '21 at 01:13
1 Answers
1
First make sure that your
.dll
does not need to be registered in the registry on your local computer. Then you can copy and paste your.dll
file directly into thescm
website for testing. If it can be successful, then it can be supported.In this way, we only need to add the following code to the
.csproj file
, and include your.dll
file when publishing.If your .dll needs to be registered in the computer registry, then I can tell you clearly that azure web app is not supported because it is a sandbox environment.
But you can publish your application through azure container webapp or virtual machine.
Related Post

Jason Pan
- 15,263
- 1
- 14
- 29