MSIX: LoaderSearchPathOverride extension fix for "DLL not found" issue

Written by Horatiu Vladasel · August 10th, 2023

Application packaging is an ever-evolving domain, and MSIX has become the de facto choice for IT professionals and developers.When an application is packaged as an MSIX, it runs within a containerized environment that provides isolation and security.

This containerization can lead to certain differences in behavior compared to running the same Win32 application natively installed. One common issue faced when converting a Win32 app into MSIX is the dreaded “DLL not found” error.

NoteCheck out our article: MSIX limitations: How to fix “DLL not found” issue, and see how to fix this error using Package Support Framework.

Thankfully, there's more than one way to resolve this issue.

In this article,we’ll go into the usage of the LoaderSearchPathOverride extension to correct it specifically for RStudio. Let's dive right in!

What is LoaderSearchPathOverride Extension?

LoaderSearchPathOverride is an extension in the AppXmanifest schema that helps you tell the application where to look for certain files. It's like giving the application a map to find something specific in its package.

You can do that by using the LoaderSearchPathEntry child-element of the LoaderSearchPathOverride extension.

Packaging RStudio as MSIX

Repackaging RStudio as MSIX highlights this issue, where RStudio may fail to find required DLLs (e.g., R.dll) and produce a runtime error.

Let’s explore how to find specific DLL files in an RStudio MSIX package:

MSIX package DLL not found error

- When examining the application's files, we see that the DLLs are located in the VFS/ProgramFilesX64/R/R-4.3.0/bin/x64 folder.

MSIX DLL location

- By using ProcessMonitor on the application installed in its standard way, we observe that the primary executable, RStudio.exe, activates rsession.exe, which then hunts for these DLLs in different places.

ProcessMonitor running

- Once we identify where these files are within our MSIX package, we can specify this path VFS\ProgramFilesX64\R\R-4.3.0\bin\x64 in LoaderSearchPathEntry, directing the system precisely where to look for them.

Using MSIX Packaging Tool

Now, let’s go through the process of including the LoaderSearchPathOverride extension using the MSIX Packaging Tool:

1. Open the AppXManifest file from the Package editor window.

2. Navigate to Package/Extensions.

3. Add the following extension:

<Extensions>
	<uap6:Extension Category="windows.loaderSearchPathOverride">
      <uap6:LoaderSearchPathOverride>
        <uap6:LoaderSearchPathEntry FolderPath="VFS\ProgramFilesX64\R\R-4.3.0\bin\x64" />
      </uap6:LoaderSearchPathOverride>
	</uap6:Extension>
  </Extensions>

4. Update theAppXManifest to include the uap6 schema reference.

xmlns:uap6="http://schemas.microsoft.com/appx/manifest/uap/windows10/6"

Using Advanced Installer

For Advanced Installer users, the process to add the VFS\ProgramFilesX64\R\R-4.3.0\bin\x64 to LoaderSearchPathEntry is even simpler:

  1. Navigate to the Declarations page.
  2. Add Package Declaration Loader Search Path Override.
  3. Advanced Installer will automatically add the corresponding LoaderSearchPathOverride extension in AppXManifest and declare the uap6 schema reference.
Add LoaderSearchPathOverride extension to MSIX

Discover how you can streamline your MSIX packaging process with Advanced Installer. Click here to begin your 30-day free trial today!

Conclusion

The Package Support Framework is a powerful tool to ensure applications run properly within an MSIX container. However, the LoaderSearchPathOverride extension is an alternative that proves to be effective as well.

Whether you're an IT professional or a developer in the application packaging industry, understanding the LoaderSearchPathOverride extension will equip you with another valuable tool in your MSIX packaging arsenal. Use this guide to enhance your proficiency in MSIX packaging, and explore the simplicity that tools like Advanced Installer offer in managing the "DLL not found" issue.

Written by
See author's page
Horatiu Vladasel

Horatiu is a Software Packager/Sequencer with over 10 years experience, who has worked as a Software Packager at IBM and is currently offering software packaging services to companies such as BT or Nationwide.

Comments: