With Windows 10’s Anniversary Update, Microsoft is making it possible for developers to convert traditional Windows desktop applications to Universal Windows Platform (UWP) applications. But anyone can do this with any app–not just developers.
With Windows 10’s converter, just give it a .msi or .exe file and it’ll spit out a .appx package. You can then sideload this app on your own PC, or–if you’re the application’s developer–you can submit the resulting UWP app to the Windows Store. This feature will arrive for everyone with Windows 10’s Anniversary Update, bringing many “legacy” applications to the Windows Store.
Why You’d Want to Do This
This feature is the end result of Microsoft’s Project Centennial, which is designed to bring those “legacy” Win32 and .NET Windows desktop applications to the Windows Store and the new Universal Windows Platform.
You might wonder why anyone would want to convert a desktop application to a new UWP app. For one thing, only UWP apps are allowed in the Windows Store. This allows developers to get a lot more eyes on their apps, not to mention single-click installation, easy purchasing, and automatic updates.
Microsoft’s new application platform is also sandboxed, so there’s a security benefit to converting old apps to UWP apps. The converter tool will analyze your desktop app’s behavior and create a sandbox just for it, giving it only the permissions it needs to run properly. If the application is compromised, it won’t be able to break out of that limited sandbox and mess with the rest of the system. Applications will install and uninstall cleanly without leaving junk lying around on the file system and in the registry.
The resulting applications are still powerful, despite the sandbox. These applications can use UWP features, but should be just as powerful as a traditional desktop application. As Microsoft’s documentation says: “As a UWP app, your app is able to do the things it could do as a classic desktop app. It interacts with a virtualized view of the registry and file system that’s indistinguishable from the actual registry and file system.”
There are some important limitations here. First, you can only do this on the Windows 10 Anniversary Update. For now, it’ll work with Windows 10 Insider Preview build 14316 and higher, so you’ll need to join the Windows Insider program and use an Insider Preview build of Windows 10.
This feature also requires either the Professional or Enterprise editions of Windows 10. Windows 10 Home users won’t be able to use the Desktop App Converter. As of build 14316, it only worked on Windows 10 Enterprise, but support for Windows 10 Professional is coming. Currently, this tool can only be used on 64-bit versions of Windows, and the resulting AppX package can only be installed on 64-bit versions of Windows. This will change in future Insider builds of Windows 10.
The resulting applications are intended for Windows 10 PCs. They won’t work on Windows 10 Mobile smartphones, Xbox One, HoloLens, Surface Hub, and the other Windows 10 platforms that run UWP apps. However, if you’re a developer, Microsoft offers a path to getting your desktop application into a cross-platform UWP application: “If you choose to move all of your app’s functionality out of the full-trust partition of the app and into the app container partition, then your app will be able to run on any Windows 10 device.”
However, some types of application behavior aren’t supported. An application can’t require it be run as Administrator or use other types of low-level system access. Microsoft provides a list of behaviors that aren’t allowed.
How to Set Up the Desktop App Converter
Assuming you’re using a new enough build of the Windows 10 Insider Preview, you can download and install the Desktop App Converter from Microsoft’s Developer site. Download both the DesktopAppConverter.zip and BaseImage-14316.wim files. Extract the downloaded DesktopAppConverter.zip file to a folder on your computer and place the BaseImage file in the same directory. (If there’s a new build of Windows 10 available, you should see a new BaseImage file. You’ll need to use the BaseImage file with the same version number as your installed build of Windows 10.)
You’ll also need to download and install the Windows 10 SDK.
Next, open a PowerShell window as Administrator. To do so, open the Start menu, search for “PowerShell,” right-click its shortcut, and select “Run as Administrator.”
Change PowerShell’s execution policy by running the following command. Agree to the change by typing
Run the command below, replacing
C:\Users\NAME\Downloads\DesktopAppConvertor with the path to the directory on your computer:
cd -Path C:\Users\NAME\Downloads\DesktopAppConvertor
Set up the Desktop App Converter by running the following command:
.\DesktopAppConverter.ps1 -Setup -BaseImage .\BaseImage-14316.wim
If you’re asked to reboot while running any of these commands, reboot your computer and then run the command again.
How to Convert a Desktop Application
You can now run the
DesktopAppConverter.ps1 script from an Administrator PowerShell window to convert a desktop application to a UWP application in a single command. You’ll need the application’s installer to do this. As an example, we’ll use VLC here.
To view the detailed list of options, you can run the following command at any time:
get-help .\DesktopAppConverter.ps1 -detailed
Here’s a command you can use and adjust for your application:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14316 –Installer C:\Installer\MyApp.exe -InstallerArguments "/S" -Destination C:\Output\MyApp -PackageName "MyApp" -Publisher "CN=<publisher_name>" -Version 0.0.0.1 -MakeAppx -Verbose
You’ll need to adjust the command to add your own publisher name, version, package name, and point it at the installer file and destination directory you prefer. The
-InstallerArguments "/S" option here passes the
/S switch to the installer, which makes many application installers install silently without any user input. Applications must be installable without any user input or you can’t convert them.
The application’s installer should be in its own directory without any other files, as the files in the same directory as the installer will be copied into the resulting .appx package.
For example, we’re using VLC here, so here’s the command we’d use:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14316 –Installer C:\Users\chris\Downloads\vlc\vlc-2.2.2-win32.exe -InstallerArguments "/S" -Destination C:\Output\VLC -PackageName "VLC" -Publisher "CN=VideoLAN" -Version 0.2.2.2 -MakeAppx -Verbose
The tool will give you an .appx package, which is the UWP version of the app.
How to Install the App Without Signing It
You’re normally required sign apps with a valid signature before they can be installed. Microsoft recommends creating a self-signed certificate and signing the app with that on your computer. You can do that using the instructions below, if you like.
However, if you just want to install the app on your own computer, you can do this yourself faster, without messing with any signatures. Windows 10 allows you to install apps without signing them if you’re installing an “unpackaged” app from a directory.
To do this, open a PowerShell window as Administrator and run the following command:
Add-AppxPackage -Path C:\Path\to\AppxManifest.xml -Register
You’ll find the AppxManifest.xml file next to the Application.appx file in the output directory you specified.
You can now launch the application from your Start menu. It will be a “Windows app” instead of a “Desktop app,” but it will otherwise look and work like a normal desktop app.
How to Sign and Install the App
You don’t need to follow these instructions if you’ve already installed the application. This is the harder way.
You can normally only install an .appx package if it has a valid signature. Microsoft recommends using the signtool.exe application included with the Windows 10 SDK to create a self-signed certificate, which will allow you to install and test the application on your own computer.
Just open a Command Prompt window as Administrator and run the following commands to create a self-signed certificate and sign the .appx package with it:
cd "C:\Program Files (x86)\Windows Kits\10\bin\x64"
MakeCert.exe -r -h 0 -n "CN=Publisher" -eku 220.127.116.11.18.104.22.168.3 -pe -sv my.pvk my.cer
pvk2pfx.exe -pvk my.pvk -spc my.cer -pfx my.pfx
signtool.exe sign -f my.pfx -fd SHA256 -v C:\Path\to\application.appx
Note that the publisher you specify–that’s the
"CN=Publisher" –must match the publisher you specified earlier when creating the AppX file. So, continuing with our VLC example from above, we’d have to use
You’ll be asked to enter a password. You can just leave the password blank.
You can now install the .appx package in a PowerShell (Administrator) window with the Add-AppxPackage command:
This feature can be used by anyone, but only developers–and maybe some system administrators–will want to go this route. Luckily, the process is extremely easy for developers, assuming their applications don’t require any functionality that isn’t supported by the UWP sandbox.