Understanding how packaged desktop apps run on Windows - MSIX (2024)

  • Article

This topic describes the types of desktop apps that you can create a Windows app package for, together with some operating system (OS) behaviors—and other specifics—that are important to be aware of. We'll go into details of the following items (as we'll see, the specific behavior depends on the type of your app):

  • Your app's install location and working directory (which might be different from what your app has assumed in the past).
  • The OS's file system and registry behavior.
  • Uninstallation.

Types of desktop app

There are two types of desktop app that you can create and package. You declare your app's type in its app package manifest by using the uap10:RuntimeBehavior attribute of the Application element:

  • One type includes both WinUI 3 apps (which use the Windows App SDK) and Desktop Bridge apps (Centennial). Declared with uap10:RuntimeBehavior="packagedClassicApp".
  • The other type represents other kinds of Win32 app, including apps packaged with external location. Declared with uap10:RuntimeBehavior="win32App".

Universal Windows Platform (UWP) apps (uap10:RuntimeBehavior="windowsApp") are also packaged; but this topic isn't about them.

And then the uap10:TrustLevel attribute (of the same Application element) determines whether or not your packaged app's process runs inside an app container.

  • A full trust app. Declared with uap10:TrustLevel="mediumIL".
  • An appContainer app. Declared with uap10:TrustLevel="appContainer". Runs in a lightweight app container (and is therefore isolated using file system and registry virtualization). For more info, see MSIX appContainer apps.

Important

For more details, dependencies, and capability requirements, see the documentation for those two attributes in Application. Also see uap10 was introduced in Windows 10, version 2004 (10.0; Build 19041).

The purpose of packaging, and app containers

The purpose of packaging your app is to grant it package identity at runtime. Package identity is needed for certain Windows features (see Features that require package identity). You can package all combinations of app types described above (and thereby benefit from package identity).

But a key goal of an appContainer app is to separate app state from system state as much as possible, while maintaining compatibility with other apps. Windows accomplishes that by detecting and redirecting certain changes that it makes to the file system and registry at runtime (known as virtualizing). We'll call out when a section applies only to virtualized apps.

Installation

App packages are installed on a per-user basis instead of system-wide. The default location for new packages on a new machine is under C:\Program Files\WindowsApps\<package_full_name>, with the executable named app_name.exe. But packages can be installed in other places; for example, Visual Studio's Start commands use the project's $(OutDir).

After deployment, package files are marked read-only, and are heavily locked down by the operating system (OS). Windows prevents apps from launching if those files are tampered with.

The C:\Program Files\WindowsApps location is what's known as a PackageVolume. That location is the default PackageVolume that Windows ships with; but you can create a PackageVolume on any drive, and at any path. Furthermore, not all packages are installed in a PackageVolume (see the Visual Studio example above).

File system

The OS supports different levels of file system operations for packaged desktop apps, depending on the folder location.

Optimized for your device

In order to avoid duplication of files (to optimize for disk storage space and reduce the bandwidth needed when downloading files), the OS leverages single storage and hard linking of files. When a user downloads an MSIX package, the AppxManifest.xml is used to determine whether the data contained with the package already exist on disk from an earlier package installation. If the same file exists in multiple MSIX packages, then the OS stores the shared file on disk once only, and creates hard links from both packages to the shared file. Since files are downloaded in 64Kb blocks, even if a percentage of a file being downloaded exists on disk, only the increment that's different is downloaded. That reduces the bandwidth used for downloading.

AppData operations on Windows 10, version 1903 and later

This section applies only to virtualized apps.

All newly created files and folders in the user's AppData folder (for example, C:\Users\<user_name>\AppData) are written to a private per-user, per-app location; but merged at runtime to appear in the real AppData location. That allows some degree of state separation for artifacts that are used only by the app itself; which enables the system to clean up those files when the app is uninstalled.

Modifications to existing files under the user's AppData folder is allowed in order to provide a higher degree of compatibility and interactivity between apps and the OS. That reduces system "rot" because the OS is aware of every file or directory change made by an app. State separation also allows packaged desktop apps to pick up where an unpackaged version of the same app left off. Note that the OS doesn't support a virtual file system (VFS) folder for the user's AppData folder.

AppData operations on OSes earlier than Windows 10, version 1903

This section applies only to virtualized apps.

All writes to the user's AppData folder (for example, C:\Users\<user_name>\AppData)—including create, delete, and update—are copied on write to a private per-user, per-app location. That creates the illusion that the packaged app is editing the real AppData when it's actually modifying a private copy. By redirecting writes that way, the system can track all file modifications made by the app. That allows the system to clean up those files when the app is uninstalled, thus reducing system "rot", and providing a better app removal experience for the user.

Working directory, and application files

This section applies only to virtualized apps.

In addition to redirecting AppData, Windows' well-known folders (System32, Program Files (x86), etc.) are dynamically merged with corresponding directories in the app package. Each package contains a folder named VFS at its root. Any reads of directories or files in the VFS directory are merged at runtime with their respective native counterparts. For example, an app could contain C:\Program Files\WindowsApps\<package_full_name>\VFS\SystemX86\vc10.dll as part of its app package, but the file would appear to be installed at C:\Windows\System32\vc10.dll. That maintains compatibility with desktop apps that expect files to live in non-package locations.

Writes to files/folders in the app package aren't allowed. Writes to files and folders that aren't part of the package are ignored by the OS, and are allowed as long as the user has permission.

Common file system operations

This short reference table shows common file system operations and how the OS handles them.

OperationResultExample
Read or enumerate a well-known Windows file or folderA dynamic merge of C:\Program Files\<package_full_name>\VFS\<well_known_folder> with the local system counterpart.Reading C:\Windows\System32 returns the contents of C:\Windows\System32 plus the contents of C:\Program Files\WindowsApps\<package_full_name>\VFS\SystemX86.
Write under AppDataWindows 10, version 1903 and later: New files and folders created under the following directories are redirected to a per-user, per-package private location:
  • Local
  • Local\Microsoft
  • Roaming
  • Roaming\Microsoft
  • Roaming\Microsoft\Windows\Start Menu\Programs
In response to a file open command, the OS will open the file from the per-user, per-package location first. If that location doesn't exist, then the OS will attempt to open the file from the real AppData location. If the file is opened from the real AppData location, then no virtualization for that file occurs. File deletes under AppData are allowed if user has permissions.Earlier than Windows 10, version 1903: Copy on write to a per-user, per-app location.
AppData is typically C:\Users\<user_name>\AppData.
Write inside the packageNot allowed. The package is read-only.Writes under C:\Program Files\WindowsApps\<package_full_name> aren't allowed.
Write outside the packageAllowed if the user has permissions.A write to C:\Windows\System32\foo.dll is allowed if the package doesn't contain C:\Program Files\WindowsApps\<package_full_name>\VFS\SystemX86\foo.dll, and the user has permissions.

Packaged VFS locations

This section applies only to virtualized apps.

This table shows where files shipping as part of your package are overlaid on the system for the app. Your app will perceive these files to be in the listed system locations when in fact they're in the redirected locations inside C:\Program Files\WindowsApps\<package_full_name>\VFS. The FOLDERID locations are from the KNOWNFOLDERID constants.

System locationRedirected location (Under [<package_root>]\VFS)Valid on architectures
FOLDERID_SystemX86SystemX86x86, amd64
FOLDERID_SystemSystemX64amd64
FOLDERID_ProgramFilesX86ProgramFilesX86x86, amd6
FOLDERID_ProgramFilesX64ProgramFilesX64amd64
FOLDERID_ProgramFilesCommonX86ProgramFilesCommonX86x86, amd64
FOLDERID_ProgramFilesCommonX64ProgramFilesCommonX64amd64
FOLDERID_WindowsWindowsx86, amd64
FOLDERID_ProgramDataCommon AppDatax86, amd64
FOLDERID_System\catrootAppVSystem32Catrootx86, amd64
FOLDERID_System\catroot2AppVSystem32Catroot2x86, amd64
FOLDERID_System\drivers\etcAppVSystem32DriversEtcx86, amd64
FOLDERID_System\driverstoreAppVSystem32Driverstorex86, amd64
FOLDERID_System\logfilesAppVSystem32Logfilesx86, amd64
FOLDERID_System\spoolAppVSystem32Spoolx86, amd64

Registry

This section (and its sub-sections) applies only to virtualized apps.

App packages contain a registry.dat file, which serves as the logical (virtual) equivalent of HKLM\Software in the real registry. At runtime, the virtual registry merges the contents of that hive into the native system hive to provide a single view of both. For example, if registry.dat contains a single key Foo, then a read of HKLM\Software at runtime will also appear to contain Foo (in addition to all the native system keys).

Although MSIX packages include HKLM and HKCU keys, they are treated differently. Only keys under HKLM\Software are part of the package; keys under HKCU or other parts of the registry are not. Writes to keys or values in the package aren't allowed. Writes to keys or values not part of the package are allowed as long as the user has permission.

All writes under HKCU are copied on write to a private per-user, per-app location. Traditionally, uninstallers are unable to clean HKEY_CURRENT_USER because the registry data for logged-out users is unmounted and unavailable.

All writes are kept during package upgrade, and deleted only when the app is removed entirely.

Common registry operations

Most of this section applies only to virtualized apps.

This short reference table shows common registry operations and how the OS handles them.

OperationResultExample
Read or enumerate HKLM\SoftwareA dynamic merge of the package hive with the local system counterpart.If registry.dat contains a single key Foo, then at runtime a read of HKLM\Software shows the contents of both HKLM\Software and HKLM\Software\Foo.
Writes under HKCUCopied on write to a per-user, per-app private location.The same as AppData for files.
Writes inside the package.Not allowed. The package is read-only.Writes under HKLM\Software aren't allowed if a corresponding key/value exist in the package hive.
Writes outside the packageIgnored by the OS. Allowed if the user has permissions.Writes under HKLM\Software are allowed as long as a corresponding key/value doesn't exist in the package hive, and the user has the correct access permissions.

Uninstallation

This section applies only to virtualized apps.

When a package is uninstalled by the user, all files and folders located under C:\Program Files\WindowsApps\<package_full_name> are removed, as well as any redirected writes to AppData or the registry that were captured during the packaging process.

Understanding how packaged desktop apps run on Windows - MSIX (2024)

FAQs

What are the capabilities of MSIX package? ›

The MSIX package format preserves the functionality of existing app packages and/or install files in addition to enabling new, modern packaging and deployment features to Win32, WPF, and Windows Forms apps. MSIX enables enterprises to stay current and ensure their applications are always up to date.

What is the use of MSIX packaging tool driver? ›

The MSIX Packaging Tool enables you to repackage your existing desktop applications to the MSIX format. It offers both an interactive UI and a command line for conversions, and gives you the ability to convert an application without having the source code.

What are packaged desktop apps? ›

Commonly, a packaged app's process runs inside a lightweight app container, and is isolated using file system and registry virtualization (see AppContainer for legacy apps and MSIX AppContainer apps). But you can configure a packaged app to not run in an app container.

What are packaged Windows apps? ›

Packaged apps are based on a model that ensures all the files within an app package share the same identity. With classic Windows apps, each file within the app could have a unique identity. With packaged apps, it's possible to control the entire app by using a single AppLocker rule.

What is the difference between MSIX and EXE? ›

EXE setups have different parameters based on the tool that was used to create the installer, while some EXE's don't support silent install parameters at all. The EXE file can install an application, but it can also be the program's main executable, whereas MSI files only install applications.

What is the benefit of MSIX app attach? ›

With both MSIX app attach and app attach, applications aren't installed locally on session hosts or images, making it easier to create custom images for your session hosts, and reducing operational overhead and costs for your organization.

How does MSIX work? ›

The MSIX Packaging Tool enables you to update existing desktop application packages to the MSIX format. The MSIX SDK provides all of the APIs needed to verify, validate, and unpack an MSIX package on any platform, including non-Windows 10 platforms.

How do I package an MSIX application? ›

Download the MSIX packaging tool from the Windows Store on a device running Windows10, version 1809 or above. Launch the tool and select Application Package to create the MSIX app package. Browse and select the installer to be packaged. Under Additional Options, check the Sign Package box and select a .

What is MSI application packaging? ›

As outlined in the MSI Packaging Essentials, the process of creating an MSI package involves capturing the files, registry settings, and other components of an application and organizing them into a standardized format to be installed on target systems.

How do desktop apps work? ›

A desktop application can be defined as a program that is installed or runs directly on the system. It can be called from the GUI or a terminal window by double-clicking on its icon, which will open up its main window. Assessing and using the desktop application is a straightforward process.

What is the difference between app and desktop app? ›

Desktop applications run natively on your computer system and don't need to transfer data over the internet. This makes them much faster than web apps, which rely on network connections. Desktop apps can respond instantly to user input without any lag or delay.

Is Windows full of bloatware? ›

Like its predecessors, Windows 11 comes with a lot of bloatware. This not only takes up memory space, but also impairs the performance of the system. Here's how to get rid of superfluous software.

What is the difference between packaged and unpackaged apps? ›

The takeaway is that packaged apps are the only kind that have package identity (and they have the best install experience). An unpackaged app doesn't have package identity; so it can't use the APIs/features mentioned above.

What is a packaged app? ›

A packaged app is a web app that's bundled into a . crx file and can use Chrome extension features. You build a packaged app just like you build an extension, except that a packaged app can't include a browser action or page action. Instead, a packaged app includes at least one HTML file within its .

What are the requirements for MSIX? ›

MSIX Package Requirements

Desktop and a MinVersion matching the operating system build number. Make sure to also include the relevant Windows 10 1709 and later entry as well so the app will deploy properly on operating systems that natively support MSIX.

What is the MSIX packaging tool format? ›

MSIX is an app package format, designed to wrap and install software on devices running on Windows 10 and higher. It was initially introduced as a next-generation format, intended to replace AppX packages.

What is the package size limit for MSIX? ›

The main limitation is that package file size must be less than 30GB.

What is the difference between MSIX and MSIX app attach? ›

Packaging: Unlike MSIX, MSIX app attach doesn't involve packaging applications in the same way. Instead, it lets you dynamically attach MSIX packages to virtual machines or sessions when needed.

Top Articles
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5824

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.