简体   繁体   中英

Can't load external DLLs from MSIX packed application

What works in normal desktop application

When we try to load a dll from a normal desktop application the system automatically checks the directories specified in the environment variable "PATH" and finally, the dll is found. Eg we are using NVidia CUDA dlls this way.

What doesn't work when application is packed into MSIX?

When we pack this application into MSIX the dlls can't be found any more, because the packed application doesn't check the folders specified in the environment variable "PATH".

In some cases a workaround would be to load the dll dynamically from code, but it only works when the dll has no dependencies. Otherwise the loaded dll is not able to find it's dependecies.

What's the recommended approach to load the dlls to which path is defined in environment variable "path" from MSIX packed application?

  • Platform: Windows 10/11
  • Language: .NET/C#

How do you know the DLLs are not found when packaged as MSIX? Are you debugging the app with Visual Studio or using Process Monitor?

From what I know an application packaged as MSIX should still be able to load resources from folders listed under PATH env var. An MSIX package cannot write in the PATH env var, but the application it installs should be able to read it.

A known problem with loading DLLs from MSIX packages is when the DLLs are in a different folder from the one where the EXE loading is found. But this applies only to DLLs that you deploy inside your package, not DLLs installed by other applications on the machine.

The role of the MSIX container is to isolate the resources from the MSIX package (restrict other applications from accessing them), but the application deployed via an MSIX should be able to "see" all the resources present on the machine (installed by other non-MSIX packages), just like any other application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM