Enable Xamarin Continuous Integration Using VSTS and Xamarin Cloud

I build and test Xamarin and Xamarin Test Cloud using Visual Studio Team Services. It works fine. However, I had some pitfalls for building/testing it. I'd like to share these pitfalls and solutions.

Environment

Xamarin Project: (Android(Xaml)/iOS(Forms))
IDE : Visual Studio 2015 Update 3 (Android), Xamarin Studio for Mac (iOS)
Build Agent: Hosted(Android), MacOSX + VSTS Build Agent(iOS)

VSTS Build Definitions

Xamarin iOS

2016-09-14 (3)

Xamarin.Android

2016-09-14 (2)

 

1. App does not contain permission (Android)

App does not contain permission 'android.permission.INTERNET', please include this permission

You just add this permission into AndroidManifest.xml
AndroidManifest.xml sample

 

2.  Unable to find the nunit.framework.dll in the assembly directory. (Android)

You need to include the dll in your assembly.

Using Visual Studio

References > nunit.framework (Right click) > Properties > Copy Local > True

3. Unable to find the unuit.framework.dll in the assembly directory. (iOS)

The cause is the same as Android's one. However, it might be confusing. If you use Xamarin Studio and try to change "Local Copy for it" However, it looks already "True." But it is actually "False" as default. You need to edit *.csproj file. See the example below.

Unable to find the nunit.framework.dll in the assembly directory. In Xamarin Studio you may have to right-click on the nunit.framework reference and choose Local Copy for it to be included in the output directory.

xxx.csproj file sample

4. The .ipa file does not seem to be linked with Calabash framework.

If you want to enable Calabash, just add this line into your code. Then the compiler include
Calabash library.

#if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif

See This page.

Also, you need to edit your csproj file as well. You need to include ENABLE_TEST_CLOUD constants in the DefineConstants tag

See this csproj sample

I configure it for Release. You need to consider this part when you use in production.

Conclusion

You can build and test  Xamarin project using VSTS.  Enjoy coding!

2016-09-14 2016-09-13 (2)