Lab 1b: Add an app to your image

We're now going to take an app (like the sample IoT Core Default app), package it up, and create a new image you can load onto new devices.

For background apps, use the same method to install and run them. Note, only one app can be selected as the startup app, all other apps installed using this method run as background apps.

Note  As we go through this manufacturing guide, ProjectA will start to resemble the SampleA image that's in C:\IoT-ADK-AddonKit\Source-arm\Products\SampleA.


We'll use the ProjectA image we created from Lab 1a: Create a basic image.

Create an appx package

You can skip these steps if you've already created and tested your app.

  1. Create a UWP app. This can be any app designed for IoT Core, saved as an Appx Package. For our example, we use the IoT Core Default app.

  2. In Visual Studio, to save the IoT Core Default app as an Appx package, click Project > Store > Create App Packages > No > Next.

  3. Select Output location: C:\DefaultApp (or any other path that doesn't include spaces.)

  4. Select Generate app bundle: Never

  5. Click Create.

    Visual Studio creates the Appx file into C:\DefaultApp\IoTCoreDefaultApp_1.2.0.0_ARM_Debug_Test

  6. Optional: Test the app. Note, you may have already tested the app as part of building the project.

Package the app

Create a package for an app

  1. From the IoT Core Shell, create a new appx package using New-IoTAppxPackage

    Add-IoTAppxPackage "C:\DefaultApp\IoTCoreDefaultApp_1.2.0.0_ARM_Debug_Test\IoTCoreDefaultApp_1.2.0.0_ARM_Debug_Test.appx" fga Appx.MyUWPApp
    (or) newappxpkg "C:\DefaultApp\IoTCoreDefaultApp_1.2.0.0_ARM_Debug_Test\IoTCoreDefaultApp_1.2.0.0_ARM_Debug_Test.appx" fga Appx.MyUWPApp

    This creates a new folder at C:\MyWorkspace\Source-<arch>\Packages\Appx.MyUWPApp, copies the appx files and its dependencies and generates a customizations.xml file as well as a package xml file that is used to build the package.

    This also adds a FeatureID APPX_MYUWPAPP to the C:\MyWorkspace\Source-<arch>\Packages\OEMFM.xml file.

  2. From the IoT Core Shell, build the package using New-IoTCabPackage.

    New-IoTCabPackage Appx.MyUWPApp
    (or) buildpkg Appx.MyUWPApp

    The package is built, appearing as C:\MyWorkspace\Build\<arch>\pkgs\<oemname>

Update the project's configuration files

Replace your product's default app with your own

  1. Add the FeatureID for our app package using Add-IoTProductFeature

    Add-IoTProductFeature ProductA Test APPX_MYUWPAPP -OEM
    (or) addfid ProductA Test APPX_MYUWPAPP -OEM
  2. Remove the sample test apps IOT_BERTHA using Remove-IoTProductFeature

    Remove-IoTProductFeature ProductA Test IOT_BERTHA
    (or) removefid ProductA Test IOT_BERTHA

Build and test the image

Build and flash the image using the same procedures from Lab 1a: Create a basic image. Short version:

  1. From the IoT Core Shell, build the image (buildimage ProductA Test).
  2. Install the image: Start Windows IoT Core Dashboard > Click the Setup a new device tab > select Device Type: Custom >
  3. From Flash the pre-downloaded file (Flash.ffu) to the SD card: click Browse, browse to your FFU file (C:\MyWorkspace\Build\<arch>\ProductA\Test\Flash.ffu), then click Next.
  4. Enter the device name and password. Put the Micro SD card in the device, select it, accept the license terms, and click Install.
  5. Put the card into the IoT device and start it up.

After a short while, the device should start automatically, and you should see your app.

Next steps

Lab 1c: Add a file and a registry setting to an image

Update apps on your IoT Core devices