Deployment of .net application on Raspberry 2

Most of the time when look at development on IOT device using .net and windows 10 IOT version, the deployment is done directly Visual studio.

In my case, the raspberry is installed on a closed network and my access to it is limited to web interface. So the use of the app deployment process available on admin web interface is mandatory.

I have search for long time to archive this and here the result.
Some part of the process is still manual, and will maybe automated in the future.

I have created an application to display some web page and to trigger the refresh automatically.
I want to deploy new release of the application without shutting down the raspberry, by using the web admin interface.

Dev platform:

Windows 10 insider fast ring version always updated.
Visual studio 15 community version up to date.

Raspberry 2/3 with 8gb sd card (windows IOT insider and normal version)

Assumption:

Solution folder is: C:\dev\MyApp
Project folder is C:\dev\MyApp\AppProject
Deployment folder is C:\dev\MyApp\deploy

1st step – compile the application :

In visual studio build the application for ARM device and in Release.

2nd step – Adapt image filename:

This step is still under investigation, and it is more like a workaround the normal way of working.
This could be archive by creating a custom build step.

Starting your project folder go to bin\ARM\Release\ilc\Assets, you should see all logo for the application, rename the log with .scale-200 by removing that part.

3rd step - Pack the application:

In folder “C:\Program Files (x86)\Windows Kits\10\bin\x64”, you have a MakeAppx.exe application that will handle that part.

 MakeAppx.exe pack /d C:\dev\MyApp\AppProject \bin\ARM\Release\ilc\ /p C:\dev\MyApp\deploy \MyApp.appx

4th step - Sign the application:

You have to create a new certificate for your application with a password, see annexe 1 for the procedure if needed.

In folder “C:\Program Files (x86)\Windows Kits\10\bin\x64”

signtool.exe sign /a /v /fd SHA256 /f C:\dev\MyApp\MyAppKey.pfx /p [PASSWORD] C:\dev\MyApp\deploy\MyApp.appx

 

5th step – Deploy the application:

Go to admin web interface in Apps section.

In “Install app” part of the page:

-          App package: select the appx you create and sign at step 3 and 4

-          Certificate: select the certificate you use to sign the appx at step 4

-          Dependency: select 2 appx files

o        C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.NET.Native.Framework.1.3\1.3\arm\ret\Native\Microsoft.NET.Native.Framework.1.3.appx

o        C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.NET.Native.Runtime.1.4\1.4\AppX\arm\ Microsoft.NET.Native.Runtime.1.4.appx

You may need to adapt the version 1.3 and 1.4 to what you have on your machine

The “Go”

After a while the application will be installed and you see it arriving in the “Running apps” list.

 

Annex 1 – Create application certificate

In Visual studio, go to properties of the project, in application tab click on “Package Manifest…”.
A new window open, then go to “Packaging” tab.
Click on “Choose certificate…”, a new popup window appears.
To export it, chose “View Full Certificate”, this will guide you to the normal certificate window.
On “Details” tab, select “Copy to file…” option and follow the wizard.

Category: 
Howtos pour IOT