Reputation: 5269
I am trying to setup a CI/CD pipeline, where my UWP app code is in VSTS and I need it to deploy to a Raspberry PI with W10 IOT (17134). I have set up a build/release agent on my dev PC so that the agent can communicate to the Pi over the network.
I tried to use Copy Files task (successfully) and then run a Powershell script to install the package. That all works, but it installs it under the Administrator account, where as in Win10 IOT you need to install it for the DefaultAccount account if you want it to be able to run.
Now i am at a loss; I just can't figure out how i can deploy my app remotely to my device so that it is run and owned by DefaultAccount. However, I know i can deploy it from Visual Studio (but I don't want that, i want it to be deployed from a VSTS build/deploy agent automatically). I can't figure out though how VS2017 is able to deploy it (without credentials, I may add!). I can also upload the package via the Device Portal and it installs just fine, but that would be manual. I tried to backtrace what requests was being made from the device portal and stumbled upon the Device Portal Core API, but I have no idea how to make a POST call with just the package from VSTS. I tried to use a post-release Powershell script that would run on the deployment agent (same network as the Pi, and from the same machine a can deploy from VS2017) but I am unable to create a Invoke-Method that successfully submits a multipart form. I can only find hacks (like here and here) that returned errors that the file was corrupted (at best, often it didn't even receive the file).
So, the question is; can I mimic the VS2017 functionality to deploy an UWP app remotely? And how would I go about that?
Upvotes: 0
Views: 462
Reputation: 5269
So, I have figured it out! If you want to deploy an UWP to a Pi, you do need to have your private build/deploy agent, but you shouldn't copy the files to the device and then install it via PowerShell.
I found out about the WinAppDeployCmd tool, so in my release definition I am now running the following PowerShell:
$location = "$(System.DefaultWorkingDirectory)\*\*\*\"
cd $location
$filename = dir *.appxbundle
$file = [string]$filename[0].Name
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\WinAppDeployCmd.exe' @('install','-file',$file, '-ip', '192.168.0.xxx')
I am far from heroic in PowerShell so I know it isn't pretty, but it works:)
Upvotes: 1