Build UWP apps for sideloading

Building a Windows .exe file in Unity is a breeze, but building (and installing) a Universal Windows Platform app can be a pain in the pita.

Prerequisites

  • A Windows machine
  • Visual Studio (not Visual Studio Code!)

While regular Windows executables can be created on Linux and Mac machines, UWP apps can only be created on a Windows machine.

Build

Configure the build settings in the Unity Editor (File > Build Settings...) like in the screenshot below, and build the project. The output will be a Visual Studio project, and not a completed app.

Build settings

Allow sideloading

Unless you’re publishing the app via the Windows Store, you will need to prepare the machine that will run the app. This involves allowing sideloading apps, and installing a certificate (which we’ll do in a later step). This window will automatically open when you build the project in Unity, otherwise you can find it using the Windows search:

Allow sideloading

Building the app bundle

UWP apps are not contained in .exe files, but in App Bundles. Open the generated solution (.sln file) in Visual Studio to create this app bundle. Right click your project name in the Solution Explorer and select Publish > Create App Packages... (VS 2019) or Store > Create App Packages... (VS 2017).

Create app bundle

Follow the steps to create an app for sideloading:

Select sideloading

When sideloading a specific device, you can select the right architecture:

Architecture

Install certificates

The previous step will have created a .appbundlex file along with a lot of related files. One of them is a certificate (.pfx file) that is used to sign the app bundle. Right click it in Explorer, and select Install Certificate. Follow the steps below. Note: installing the certificate to the wrong store, or to ‘Current User’, will prevent your app from being installed, so follow the steps carefully!

Install certificate

Install to Current User

Browse for store

Trusted Root Certification Authorities

You can now install the app.

Install dependencies

In the generated output there is a folder Dependencies. In it is an app bundle that contains the VC redistributable that is required by the app. Double click it to install.

Install the app bundle

After installing the certificates, you can install your app bundle by double clicking it. It should show up as a Trusted App:

Trusted App

Untrusted App

Troubleshooting

  • If your app shows up as an Untrusted App when installing, please check if you correctly installed the certificates as described above.
  • If you get an error when running the app, saying a VCLib has not been located, you need to install the app bundle in the Dependencies folder. Installing the DLL in the error message manually will not fix the issue.