Thursday, January 30, 2014

Building Xamarin Applications on a TFS Build Server

Enabling Android Builds


Update: Xamarin have done a bunch of work which makes it much easier to integrate with TFS, and this will only get easier with Build vNext as it uses actual visual studio to build instead of just msbuild

  • Install the android SDK to a common path
  • Edit the TFS Build definition and in advanced settings find the "MSBuild Arguments" property and set it to "/p:AndroidSdkDirectory=E:\Android\android-sdk" obviously with the correct path
  • Edit the *.csproj file for the android project and change the first line so that DefaultTargets="Build" become DefaultTargets="SignAndroidPackage".
  • Queue a build in tfs - the APK should be put in the drop folder along with the other binaries.


Enabling iOS Builds

  • Open up the iPhone *.csproj file in a text editor, change the first line so that DefaultTargets="Build" become DefaultTargets="Build;_TfsRemoteBuild". And add a conditional propertygroup and targets
<PropertyGroup Condition=" '$(BuildingInsideVisualStudio)'!='true' ">
          <ServerAddress>Name or IP of Mac Build Server</ServerAddress>
          <BSAT>NjY3MjY5</BSAT>
         <HttpPort>5000</HttpPort>
  </PropertyGroup>
  <Target Name="_TfsRemoteBuild" Condition=" '$(BuildingInsideVisualStudio)'!='true' " DependsOnTargets="_RemoteBuild">

BSAT is the base64 encoded Pin you used to connect to the iOS build agent from Visual Studio



The server committed a protocol violation. Section=ResponseStatusLine
Unknown solution.

http://forums.xamarin.com/discussion/3696/how-to-build-from-msbuild-command-line-trig-build-on-osx-from-windows

Failed to fetch manifest from the build server

  • Ensure the build server and the Mac build server are running the same version of Xamarin 

Other Tips

  • Remember to use build server tags to mark any build controller you setup to build Xamarin builds so that you can filter by just compatible build servers when creating a build definition
  • You will need to login to your build server setup your Xamarin license in visual studio - the licenses are stored in a common place so it shouldn't matter who you login as to set this up.