AIStub.exe in MSIX - Advanced Installer's PSF Launcher
Ever looked inside an MSIX package created with Advanced Installer and noticed a file named AIStub.exe? If so, you may have wondered why it's there and what purpose it serves.
The answer is quite simple: AIStub.exe is part of Advanced Installer's solution for the Package Support Framework (PSF). It acts as a PSF launcher that Advanced Installer automatically injects into the package in certain scenarios.
Explaining the AIStub.exe PSF launcher concept
If you've previously worked with the MSIX Packaging Tool, this concept will likely sound familiar.
In MSIX Packaging Tool, the equivalent is PsfLauncher.exe, which performs a similar role by launching the application through the Package Support.
When Advanced Installer injects this launcher into your package, you'll see a new AI_STUBS folder in the package's file structure. This directory contains AIStub.exe and any other supporting files required for the PSF integration.

You'll also see another important change: the package manifest is automatically updated so that AIStub.exe becomes the application's entry point.
Windows doesn’t launch your executable directly, instead it launches AIStub.exe, which in turn initializes the PSF components that are needed and then hands control over to your application.
<Applications>
<Application EntryPoint="Windows.FullTrustApplication" Executable="AI_STUBS\AiStubX64.exe" Id="MyApp">
<uap:VisualElements AppListEntry="default" BackgroundColor="transparent" Description="MyApp" DisplayName="MyApp" Square150x150Logo="Assets\MyAppSquare150x150Logo.png" Square44x44Logo="Assets\MyAppSquare44x44Logo.png">
<uap:InitialRotationPreference>
<uap:Rotation Preference="portrait" />
<uap:Rotation Preference="landscape" />
</uap:InitialRotationPreference>
</uap:VisualElements>
</Application>
</Applications>You might have noticed in the manifest above that the executable is specifically named AiStubX64.exe.
If your package contains 32-bit elements then Advanced Installer will automatically inject AiStubx86.exe (or AiStubX64.exe in the case of 64-bit packages). This architecture mapping is done behind the scenes and you will not have to do anything in order for your package to run seamlessly.
Now, let’s dig deeper and see some scenarios where AIStub.exe is automatically injected by Advanced Installer:
Scenarios
1. When you need to set a working directory for your shortcut

If you go to Virtual Registry, you can see that the following registry keys have been injected, which are used to parse the working directory for your application executable.

2. When you need to set command-line arguments for your shortcut

Its corresponding registry key is used to parse the arguments to your application executable.
3. When you need to set a non-executable file as the target application for your shortcut

Its corresponding registry key is used to launch the batch file.

4. When you need to set an environment variable

Its corresponding registry key is used to set the environment variable within the MSIX package.

5. When your application contains resources under the User Profile

Its corresponding registry key is used for file redirection.

6. When you have any PSF fixup included within your package

In this scenario, the corresponding Fixup resources are also injected into the MSIX package along with AiStub.exe.

Conclusion
Understanding why AIStub.exe is included in your MSIX package can help you troubleshoot and inspect packages generated by Advanced Installer.
