The most common MSIX limitations and how to fix them with the Package Support Framework (PSF)

Written by Horatiu Vladasel · December 22nd, 2021

Advanced Installer was the first application to fully support MSIX technology – and we truly believe in its power.

Naturally, as it happens with any young technology, there are still some limitations within the MSIX packaging technology -- especially when compared to the MSI packaging format.

NoteIn our MSI vs MSIX: Practical Side-by-Side Comparison, we put together an overview of the features and limitations for each of the two packaging formats: MSI and MSIX. If you are new to MSIX, check out our MSIX Tutorial: A comprehensive 24-chapter guide blog article.

MSIX is always in development, and we work hard to stay on top of the updates supporting improvements that help the application packaging community.

One of the most useful improvements Microsoft released and has been working on is the Package Support Framework (PSF). It supports organizations globally with their transition to MSIX.

In this article, we will cover the most common MSIX limitations and how to fix them using the Package Support Framework (PSF).

PSF is an open-source kit, based on the Detours technology, that helps you apply fixes to your Win32 applications that are no longer under active development, so that they can run inside an MSIX container.

MSIX Challenges: Start Menu Entries

The StartMenu entries are the most common way for users to access applications on their computer. MSIX replaced the traditional .lnk shortcuts with modern application entries that are defined as an element within the AppxManifest file.

Although these modern application entries look similar to the .lnk shortcuts -- you will see that the context menu is different when right clicking on them.

Compared to the .lnk shortcuts, these modern application entries use modern APIs to launch applications – and unfortunately, they have some limitations, including:

  • No support to set current working directory;
  • No support to set command line arguments;
  • No support to set non-executable files as the target application.

Although these options are not natively supported within an MSIX package, you can use the Package Support Framework to bypass these limitations.

NoteFor more information about the Package Support Framework and how it works, have a look at our Introduction to Package Support Framework blog article.

If you are not familiar with the Package Support Framework but you are using Advanced Installer, you are in for a big surprise.

Our deep integration automatically includes fixups inside your MSIX packages, simplifying your packaging process and increasing the conversion rate, while reducing human errors.

Following up, we’ll dive into some examples to show you how Advanced Installer can help you fix and extend the functionality of your MSIX packages.

  1. How to set current working directory for MSIX target application
  2. How to set command line arguments for MSIX target application
  3. How to set non-executable files as MSIX target application

How to set current working directory for MSIX target application

With traditional .lnk shortcuts, you can set a working directory (“Start in” field in the shortcut’s property). By default, this is the directory where the target executable is located.

Shortcut Property - Working Directory

On the other hand, modern MSIX application entries do not allow for a working directory to be set.

ImportantBy default, the working directory of the target process is set to the System32 folder.

How to set the current working directory using the MSIX Packaging Tool

To go around this limitation, here are the steps you need to follow:

1. Create a new config.json and insert the following code into it:

{
    "applications": [
    	{
            "id": "",
            "executable": "",
            "workingDirectory": ""
    	}
	]
}

2. Open the MSIX package in MSIX Packaging Tool – Package Editor.

3. Open the AppxManifest.xml file.

4. Copy the value in the “Id” field within the AppxxManifest.xml file to the Applications “id” field in the config.json file.

Appxmanifest - Application Id

5. Copy the value in the “Executable” attribute of the “Application” element within the AppxManifest.xml file to the Applications “Executable” field in the config.json file.

Appxmanifest - Application Executable

6. Set the “working directory” field in the config.json file to the folder where you will start your process.

7. Save the config.json file and copy it into the MSIX package (directly in the Package Root Directory).

{
    "applications": [
        {
            "id": "MYAPP",
            "executable": "MyApp.exe",
            "workingDirectory": "MyApp Subfolder"
        }
	]
}

8. Depending on your application architecture, add the corresponding PSF files into your MSIX package (directly in the Package Root Directory, next to the config.json file).

  • PsfLauncher32.exe/PsfLauncher64.exe
  • PsfRunDll32.exe/PsfRunDll64.exe
  • PsfRuntime32.dll/PsfRuntime64.dll

9. Edit the manifest file – change the value of the “Executable” attribute of the “Application” element to point to the PsfLauncher executable instead of the original executable of your application.

Appxmanifest - PsfLauncher

Set the current working directory with Advanced Installer

With Advanced Installer, you don’t need to do any of the above. It’s all done automatically in the background for you. Just go to the “Application Details” page, scroll down to “Start Point” section and set the “Working directory” you need.

Working Directory - MSIX

How to set command line arguments for MSIX target application using the Package Support Framework (PSF)

By default, MSIX does not allow for command line arguments to be set for shortcuts. So, when you perform a capture with an open source tool - such as the MSIX Packaging Tool - any argument passed to the executable is simply ignored.

This is different from a common scenario that affects Enterprise environments, especially where Win32 apps have shortcuts to pass arguments to the executable at runtime.

How can we address this in MSIX? With the Package Support Framework.

How to set command line arguments with MSIX Packaging Tool

To bypass the command line arguments limitations in MSIX, follow these steps:

1. Create a new config.json and insert the following code into it:

{
    "applications": [
    	{
            "id": "",
            "executable": "",
            "arguments": ""
    	}
	]
}

2. Open the MSIX package in MSIX Packaging Tool – Package Editor.

3. Open the AppxManifest.xml file.

4. Copy the value in the “Id” field within the AppxxManifest.xml file to the Applications “id” field in the config.json file.

Appxmanifest - Application Id Command-line arguments

5. Copy the value in the “Executable” attribute of the “Application” element within the AppxManifest.xml file to the Applications “Executable” field in the config.json file.

Appxmanifest - Application Executable Command-line arguments

6. Set the “arguments” field in the config.json file to the value you need to be passed to the executable at runtime.

7. Save the config.json file and copy it into the MSIX package (directly in the Package Root Directory).

{
    "applications": [
        {
            "id": "MYAPP",
            "executable": "MyApp.exe",
            "arguments": "/k cd %MsixPackageRoot%/MyApp Subfolder "
        }
	]
}

Note%MsixPackageRoot% is a pseudo-variable that can be used inside of the MSIX packages and points to the root folder of the MSIX package.

8. Depending on your application architecture, add the corresponding PSF files into your MSIX package (directly in the Package Root Directory, next to the config.json file).

  • PsfLauncher32.exe/PsfLauncher64.exe
  • PsfRunDll32.exe/PsfRunDll64.exe
  • PsfRuntime32.dll/PsfRuntime64.dll

9. Edit the manifest file – change the value of the “Executable” attribute of the “Application” element to point to the PsfLauncher executable instead of the original executable of your application.

Appxmanifest - PsfLauncher Command-line arguments

How to set command line arguments with an application packaging tool - Advanced Installer

Just like setting a current working directory, setting a command line argument for the StartMenu application entry is a smooth and straightforward operation using Advanced Installer.

All you need to do is to go to the “Application Details” page, scroll down to “Start Point” section and set the “Parameters” you need.

Command line arguments - MSIX

How to set non-executable files as MSIX target application using Package Support Framework (PSF)

Many traditional Win32 apps have shortcuts that point to non-executables files (e.g. .txt, .pdf, .docx). When launched, these shortcuts trigger the default applications associated with that particular file type (FTA) and use that to open the file.

By default, MSIX does not support application entry points that are not executables. But, we can fix this limitation with the Package Support Framework (PSF).

How to set a non-executable as the target application using the MSIX Packaging Tool

Any shortcut to non-executable files is ignored by the MSIX Packaging Tool during the capture. That’s the reason why the corresponding entry needs to be manually added to the “Applications” element within the AppxManifest.xml file.

To overcome this limitation, you need to follow these steps:

1. Create a new config.json and copy the following code into it:

{
    "applications": [
    	{
            "id": "",
            "executable": ""
    	}
	]
}

2. Open the MSIX package in MSIX Packaging Tool – Package Editor.

3. Open the AppxManifest.xml file.

4. Create a new entry.

5. Point the “Executable” attribute of the “Application” element to the PsfLauncher executable.

Appxmanifest - Psflauncher - Non-executable target application

6. Copy the value in the “Id” attribute of the “Application” element within the AppxManifest.xml file to the Applications “id” field in the config.json file.

7. Save the config.json file and copy it into the MSIX package (directly in the Package Root Directory).

{
    "applications": [
        {
            "id": "MYAPPREADME",
            "executable": "MyAppLauncher.txt"
        }
	]
}

8. Depending on your application architecture, add the corresponding PSF files into your MSIX package (directly in the Package Root Directory, next to the config.json file)

  • PsfLauncher32.exe/PsfLauncher64.exe
  • PsfRunDll32.exe/PsfRunDll64.exe
  • PsfRuntime32.dll/PsfRuntime64.dll

How to set a batch file as a target in Advanced Installer

To set a batch file as a target for your application in Advanced Installer, just:

1. Go to the “Application Details” page.

2. Scroll down to the “Start Point” section.

3. Set the “Executable” field to point to the batch file.

You can see how these settings look in the image below.

Non-executable target - MSIX

Conclusion

The Package Support Framework is a very helpful tool to workaround various MSIX limitations, such as setting command line arguments for a target application or setting non-executable files as target apps in MSIX.

Let us know if you found this helpful and if you have any additional questions!

Comments: