Technology

Building and Uploading a Xamarin Forms solution using Grunt

Rob Waggott
Rob Waggott
22 May 2015
blog post featured image

Project setup can sometimes be the most difficult task of a project, technical decisions have to be made, user stories have to be created in your issue management system, documentation has to be written and your continuous integration project has to be setup.

When you're building a mobile app your continuous integration setup can often be complicated, as the bare minimum you'll need:

  • Version numbers updated to match the build number of the CI system you're using.
  • Nuget packages restored.
  • Projects built
  • Unit tests run
  • Your app uploaded to a distribution system such as <a href="http://hockeyapp.net/features/" target="_blank">Hockey App</a>

When setting up your build you could run all of these tasks independently of each other, the drawback of this being your build tasks being outside of source control with all of the advantages that source control brings, or use a build runner. In the last few projects I've been using <a href="http://gruntjs.com/ " target="_blank">Grunt</a>as my build runner of choice, it may sound strange using a Javascript task runner to build and deploy an app, but with the number of grunt tasks now available it makes perfect sense, for example, in the gist I link to below I'm using:

  • <a href="https://www.npmjs.com/package/grunt-dotnet-assembly-info" target="_blank">grunt-dotnet-assembly-info</a> to update version numbers and keep assembly information consolidated.
  • <a href="https://www.npmjs.com/package/grunt-plistbuddy " target="_blank">grunt-plistbuddy</a> to update iOS version numbers within the plist
  • <a href="https://www.npmjs.com/package/grunt-xmlpoke " target="_blank">grunt-xmlpoke</a>to update Android version numbers within the android manifest

To get you started I've gist-ed a grunt task to build, test and upload a Xamarin forms app to Hockey App, you can get the gist here:

<a href="https://gist.github.com/robert-waggott/5bb6ff4d52b211c2012a" target=_"blank">https://gist.github.com/robert-waggott/5bb6ff4d52b211c2012a</a>

Close chatbot
Open chatbot
Open chatbot