Skip to content
Steve Hannah edited this page Jun 22, 2016 · 33 revisions

UWP Apps may distributed in 2 different ways:

  1. In the Windows App Store. (This should be used for deployment of any production app).

  2. Outside of the Windows App Store via sideloading directly onto a device. This should only be used for development.

Deploying Outside of the Windows App Store (Sideloading)

UWP apps may be deployed directly to Windows 10 desktop and mobile devices without any need to involve the Windows Store. This process is only realistic, though, for testing and debugging your app during development because it requires you to enable "Development" mode on the device. In addition, installation is a little bit more complicated than simply downloading an app over the internet. The process for deploying to Windows 10 desktop devices is different than the process for mobile devices. These are described in the following sections.

Side-loading to Windows 10 Mobile Devices

Enabling Developer Mode on Device

Before you can side-load apps onto your phone, you’ll need to set up your phone for development.

  1. In "Settings", select "Update & Security" > "For developers"

    Updates & Security in UWP Mobile settings
    Developer mode in UWP Mobile settings
  2. Select "Developer mode"

  3. Under "Device Discovery", make sure that the "Make your device visible to USB connections and your local network" is set to "On".

    Device discover on in UWP Mobile settings
  4. Make sure that "Device Portal" is set to "On"

    Device Portal in UWP Mobile settings
  5. When you switch "Device Portal" to "On" it should show you an address that you can access the Phone at via wifi. (E.g. https://10.0.1.11). Remember this address, you’re going to use it to install all of your apps onto the device.

    Note
    This will be a local address within your local network. It won’t be available to the outside world.

At this point, your phone should be ready to receive "Side-loaded" apps. This was a one-time setup, so you shouldn’t have to do it again, until you set up another device.

Building App for UWP

Now that your device is set up for development, you can proceed to build your app.

  1. Select the "Mobile Debug Build" option in the UWP Codename One Settings.

    Windows panel of Codename One Settings
  2. Select the "Send Windows UWP Build" option in the Codename One menu of your IDE. This will initiate the build on the Codename One build server.

    Send UWP Build
  3. Log into the Codename One dashboard to watch the build progress. When it is complete, you’ll be able to download the ".appxbundle" file to your desktop.

    Download appxbundle file from dashboard
    Warning
    You cannot simply download the .appxbundle file directly to your Windows Phone 10 mobile device and install it. It will indeed allow you to download it, and will give you an option to install it, but the install will silently fail.
Installing App On Device
  1. Point your computer’s web browser to the address for your mobile device. (This is the address listed when you turned on the "Device Portal" in the "Enabling Developer Mode on Device" section above. This will open the App Manager page.

  2. Click on the "Apps" item in the left menu.

    UWP Apps Manager
  3. Under the "Install App" section, click the "Choose File" button and navigate through the file chooser to select the .appxbundle file for your app. If this is the first time installing an app on your device, you may also need to provide the dependencies. (You can find the dependencies for mobile/ARM apps here. You’ll need to provide both Microsoft.NET.CoreRuntime.1.0.appx and Microsoft.VCLibs.ARM.Debug.14.00.appx). Click the "Add Dependency" button, and use the file chooser to select both of the .appx dependencies. Again, The dependencies will only be required the first time you install an app this way

  4. Once you have the appxbundle and its dependencies selected, you should press "Go" under the "Deploy" subheading. This will install the app and, if all went well, your app will appear in the "Recently Added" section in the apps list of the phone.

    UWP Recently added menu

Side-loading to Windows 10 Desktop Devices

Enabling Developer Mode on PC

The easiest way to be able to run your development apps on a Windows 10 PC is to enable developer mode. This will allow you to install any app even if it is just "self-signed".

To enable developer mode, open "Settings", then select "Updates an Security". Under the "For Developers" menu item, select "Developer Mode" as shown below:

UWP Windows 10 Developer Mode
Building the App

Before building the app, you’ll need to ensure that the build target is set to "Debug Desktop" in the Codename One Settings panel for Windows apps.

Steps:

  1. Open Codename One Settings (steps vary by IDE). On Netbeans you will find "Codename One Settings" by right clicking your project’s node in the project explorer, and look in the "Codename One" submenu:

    Codename One Settings menu in Netbeans
  2. Click on "Windows Settings":

    Windows Settings menu item
  3. Under "Build Type", make sure that "Desktop Debug Build" is selected, as shown below:

    Desktop Debug Build Selected
  4. Save the changes by clicking the "Disk" icon in the upper right:

    Save icon

Now you can proceed to send the build to the build server.

  1. Select the "Send Windows UWP Build" option in the Codename One menu of your IDE. This will initiate the build on the Codename One build server.

    Send UWP Build
  2. Log into the Codename One dashboard to watch the build progress. When it is complete, you’ll be able to download the ".zip" file to the Windows 10 PC on which you wish to install the app.

    Download appxbundle file from dashboard
Installing the App

Start by extracting the .zip file. (Navigate to the folder where the zip was downloaded, right click it, and select "Extract all" as shown below:

Extract UWP zip file

After extraction, open the resulting directory. You should see contents similar to the following:

UWP Zip file contents

Downloading Dependencies

If this is your first time installing a UWP app on this PC, you may need to add the dependencies before you can install. You can download the dependencies here. Extract "Dependencies.zip" and copy the resulting "Dependencies" directory into the app install directory. Your app install directory should now look like:

UWP Zip file contents with dependencies

Running the Powershell Script

We are finally at the point where we can run the installer.

Right-click on the "Add-AppDevPackage" icon, and select "Run in Powershell", as shown:

UWP Install by run in powershell

You may be prompted that you need to change the execution policy, in Powershell:

UWP Powershell change execution policy

Enter "Y" at the prompt to allow this.

If all goes well, you should see a message saying that the app as successfully installed.

UWP Powershell app successfully installed

And if you look in your "Windows Menu" under "All Apps", you should see your app listed there:

Windows 10 App listed in All Apps

Building for the Windows Store

If you want to be able to distribute your app to the public, the Windows Store is your best channel. Building for the Windows store involves roughly 3 steps:

  1. Reserve a name for your app in the Windows Store

  2. Build your app using the "Windows Store Upload" build type.

  3. Upload the resulting .appxupload file to the Windows store.

Let’s go through these steps in more detail. Start here.

Publish windows apps webpage

If you don’t already have an account, sign up for one. Then log in. Once logged in, you can click the "Dashboard" link on the toolbar.

Windows Store dashboard

Under the "Your apps" section (on the left in the above screenshot), click the "Create new app" button.

Reserve name form

Enter a name for your app, and click "Reserve app name".

If the name was available, it should take you to the app overview page for your new app. There’s quite a few options there to play with, but we’re not going to worry about any of them for now. All we need to know is:

  1. Your App’s ID

  2. Your App’s Publisher ID

You can get this information by scrolling down to the bottom of the "App overview" page and clicking the "View app identity details" under the "App Management" > "App identity" section:

App Identity section

You’ll see a page with the information we need shown below:

App identity details

The next step is to copy this information into your Codename One project.

Open up the Codename One Settings for your project and go to the "Windows Settings" section.

Copy and paste the "Package/Identity/Name" value from the windows store into the "App ID" field.

Next, click on the "Generate" button next to the Certificate field.

This will open a dialog titled "Certificate Generator". Paste the value from the "Package/Identity/Publisher" listed in the Windows Store into the Publisher ID field as shown below:

Certificate Generator

Then click OK. This will generate a .pfx file inside your project folder.

Finally, make sure that "Windows Store Upload" is selected in the "Build Type" field:

Settings for Windows Store uploads

When you are done, hit the "Save" icon in the upper right corder of the window to save your changes.

Finally, select "Codename One" > "Send Windows UWP Build" in your IDE’s project explorer.

Custom Builds

TODO

Build Hints

TODO

Clone this wiki locally