dotnetco.de

Setup Continuous Integration with Xamarin Forms and Visual Studio Team Services VSTS

Last week I stumbled upon Luce Carters interesting Youtube Tutorial Setting up VSTS CI for Xamarin Forms. It’s very well explained, so if you prefer to watch it as a video: Switch over to Luces Tutorial! Otherwise here is a written step-by-step guide how to setup continuous Integration (CI) with Visual Studio Team Services (VSTS) for a Xamarin Forms App.

  1. In VSTS, go to “Build and Release” -> “Build” and select “New”.
  2. Source is of course “VSTS Git” so select project, repository and default branch.
  3. Now select your platform. You’ll find UWP, Xamarin Android and Xamarin iOS. My Xamarin Forms app only has iOS and Android projects, so I start with iOS now. It’s quite the same for both Android and iOS, difference is shown below.
  4. VSTS created some default tasks for your CI.
  5. Take care for iOS: In Task “Build Xamarin iOS Solution”, you have to check “Build for iOS Simulator”, otherwise your build will fail with error “/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(644,3): error : No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com.
  6. Take care for Android: If you don’t have a test project, disable the test build!
  7. Go to tab “Triggers” and tick “Enable continuous integration”.
  8. Go to tab “Save & queue” and select “Save & queue”
  9. Enter some comment if you like and click “Save & queue”.
  10. VSTS confirms that the build has been saved. You could click on the link to see the current status. As this takes some minutes, you might instead want to go ahead and do the same for Android (and maybe UWP) now.
  11. After some minutes you should get an email with the test results.

That’s it! From now on, everytime you submit code to VSTS, it will automatically build the apps and send you a test result. Very easy steps to ensure the quality of the code.

 

How to add local DLLs

I’m still using James Montemagnos Contacts Plugin which does not exist as nuget package so I’ve referenced local DLLs. For CI to work, it’s important that you add the local DLLs to your source control. Take care that the reference then uses a relative path in your .csproj file.

Resource Limits

Suddenly my builds fail. Reason is explained in the build report: With a free VSTS Account, you only have up to 240 minutes per month. Therefore I’ve now disabled CI because it’s confusing to get a failure report on every checkin.

Leave a Comment