Getting to Know Azure Mobile App Cont.
Microsoft Azure Mobile App has recently gone GA (General Availability) and has definitely captured my attention. Mobile App is a tremendous accelerator that enables us to go from an idea to a functional prototype quickly. Then, we can continue to build on that initial investment to create a robust production ready app. Finally, this post is all about using Visual Studio Team Services (VSTS) to build and publish apps to HockeyApp, so that we can test and assess quality before our apps make it to our favorite app Stores.
Streamlining the Build

Using Visual Studio Team Services (VSTS) we can easily configure your builds without having to mess around with XAML. I used an awesome post about continuous mobile deployment with VSTS as a guide to make the build/publishing pipeline for my project.
Past this point, I make the assumption that your code is already in VSTS and that you are looking to automate the build pipeline of your Universal Windows Platform (UWP) app.
In VSTS navigate to the Build section and click on the green +. Then select Universal Windows Platform and click Next.

Select the app’s repository and branch, then click Create.

Delete the ‘Index Sources & Publish symbols‘ and ‘Publish Build Artifacts‘, click Save and give the build a meaningful name.

Add build steps ‘PowerShell‘, ‘Copy and Publish Build Artefacts‘ and ‘HockeyApp‘.

Create a PS1 file called prebuild.ps1 and place it at the root of the repository. It should contain the following PowerShell script. Don’t forget to update the $filepath variable as shown below.
Param([String]$buildNumber = '') if (-Not $buildNumber) { Write-Host "buildNumber must be specified" exit 1 } # get the manifest file paths # UPDATE : $filepath = Get-Item -Path "<Project Folder>\Package.appxmanifest" $filepath = Get-Item -Path "AskAlex.App\Package.appxmanifest" Write-Host "Updating the Store App Package '$filepath' " # update the identity value $XMLfile=NEW-OBJECT XML $XMLfile.Load($filepath.Fullname) # pull out the current version $curVersion = [Version]$XMLFile.Package.Identity.Version Write-Host "Current Version: $curVersion" # bump 4th digit (revision version) $newVersion = [Version]($curVersion.Major.ToString() + '.' + $curVersion.Minor + '.' + $curVersion.Build + '.' + $buildNumber) Write-Host "New Version: $newVersion" [Environment]::SetEnvironmentVariable("LastBuildNumber", $newVersion.ToString(), "User") Write-Host ("Env variable 'LastBuildNumber' set to " + [Environment]::GetEnvironmentVariable("LastBuildNumber", "User")) # set back in to the file $XMLFile.Package.Identity.Version = [String]$newVersion # set the file as read write Set-ItemProperty $filepath.Fullname -name IsReadOnly -value $false $XMLFile.save($filepath.Fullname)
Then configure the PowerShell build step with the Script filename and arguments with -buildNumber $(Build.BuildId)

Update the Visual Studio Build platform parameter value with $(BuildPlatform). And set the MSBuild argumets
/p:AppxBundlePlatforms="$(BuildPlatform)" /p:AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\\" /p:AppxBundle=Always

Configuring the BuildPlatform variable is done through the Variables section. As shown below, you can build the App for multiple platforms.

Under the Options section, you must enable Multi-configuration and set the Multipliers parameter value to BuildPlatform.

Under the Build section, it’s now time to configure the Copy and Publish Build Artifacts. I had to figure the values for this one, because I did not follow the solution’s structure proposed by the post I used as a reference.

Under the General section, be sure to set the Build job authorization scope to Current Project.

Under the Repository section, we can set how code is pulled from the repo.

Under the Triggers section, if you are using the allocated build minutes and have no plans of buying more, be sure that Continuous integration (CI) is not checked.

Use HockeyApp
Develop, distribute, and beta-test your mobile apps. HockeyApp has support for Android, Cordova, iOS, OS X, Unity, Windows, and Xamarin apps. It enables us to get live, reliable crash reports and collect in-app feedback from real users. It’s open-source SDKs let’s us explore the code that is running in our apps and allows us to integrate HockeyApp with our existing build system and work item management solutions.
Get started by creating HockeyApp account. Then instal the VSTS HockeyApp Extension.
Next, we publish the ARM package to HockeyApp so that our testers can explore and provide feedback on each build. Pay extra attention to the Binary File Path. The HockeyApp build step works great for ARM packages because they’re dropped in the right format from the Visual Studio Build setp.

For Big Windows, there’s no “automatic” flow. Essentially, we know the version. We know the AppID – we have it set up in HockeyApp. It’s just a matter of making REST calls to HockeyApp’s API and uploading our package. Checkout this post to find out more.
Use Mobile Engagement
Azure Mobile Engagement is a user-engagement platform that provides data-driven insights about app usage, real-time user segmentation, and enables contextually-aware push notifications and in-app messaging. This provides us with the tools we need to take the necessary actions to make sure our apps thrive and succeed.
Check out this documentation to get started with Mobile Engagement. And for Windows Universal Apps make sure you take a look at the Mobile Engagement SDK Integration documentation.
Taking a Step Back
Ok, so why did I cover this in my second part? I mean, we’re developers and we like to spend time coding… The reason is actually quite selfish; it’s because I like to code. So I thought I got build tasks and publishing to HockeyApp out of the way. I honestly don’t want to do all this manually, especially if I want to go through this regularly. Deploying early versions of the app to testers can be a pain, and HockeyApp makes this easy. Best of all, I don’t have to do it manually.
So how does HockeyApp and Mobile Engagement help me spend more time coding? HockeyApp reports crashes, and it creates work items in VSTS. This means that I can track them with next to no effort. Mobile Engagement, on the other hand, is a priceless tool that helps me figure out what I need to focus on. Users are surprisingly creative and don’t always use our apps the way we intended.
Automate, collect telemetry and feedback. Make informed decisions. Get in the zone and code =)
Resources
- Welcome to the Windows developer feedback site!
- Continuous Mobile Deployment with VSTS
- Build for your platform, speaking your language
- Learn More about HockeyApp
- How to use HockeyApp with Visual Studio Team Services (VSTS)
- Transitioning Mobile Apps from Application Insights to HockeyApp
- HockeyApp Support
Share your thoughts in the comments below
In future posts, I will continue to implements various aspects of the Ask Alex Universal Windows Platform (UWP) Mobile App.