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.
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.
In Visual Studio, to save the IoT Core Default app as an Appx package, click Project > Store > Create App Packages > No > Next.
Select Output location: C:\DefaultApp (or any other path that doesn't include spaces.)
Select Generate app bundle: Never
Visual Studio creates the Appx file into C:\DefaultApp\IoTCoreDefaultApp_188.8.131.52_ARM_Debug_Test
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
From the IoT Core Shell, create a new appx package using New-IoTAppxPackage
Add-IoTAppxPackage "C:\DefaultApp\IoTCoreDefaultApp_184.108.40.206_ARM_Debug_Test\IoTCoreDefaultApp_220.127.116.11_ARM_Debug_Test.appx" fga Appx.MyUWPApp (or) newappxpkg "C:\DefaultApp\IoTCoreDefaultApp_18.104.22.168_ARM_Debug_Test\IoTCoreDefaultApp_22.214.171.124_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
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
Update the project's configuration files
Replace your product's default app with your own
Add the FeatureID for our app package using Add-IoTProductFeature
Add-IoTProductFeature ProductA Test APPX_MYUWPAPP -OEM (or) addfid ProductA Test APPX_MYUWPAPP -OEM
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:
- From the IoT Core Shell, build the image (
buildimage ProductA Test).
- Install the image: Start Windows IoT Core Dashboard > Click the Setup a new device tab > select Device Type: Custom >
- 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.
- Enter the device name and password. Put the Micro SD card in the device, select it, accept the license terms, and click Install.
- 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.