The first thing you'll need is a spare OS X machine. There happened to be a Mac Mini laying around to use.
  1. The first thing I did was to install Jenkins
  2. Once installed I created a folder to do all of the builds in. Note that Jenkins creates a user. I created the folder here: /Users/Shared/Build/. 
  3. Make sure that you give read and write permissions to the jenkins user that was created.
  4. Now download Team Explorer Everywhere (TEE)
  5. Copy TEE it to the newly created folder (/Users/Shared/Build/)
  6. Run the following commands in the command line to accept the eula of tf and allow the build to work:
    • sudo su jenkins
    • [Enter Current User Password]
    • ./tf eula
  7. On the Jenkins build server, via the web browser, go to Manage Jenkins > Manage Plugins
  8. Install the Team Foundation Server Plugin (I also upgraded the other plugins while I was there).
  9. Next go to Manage Jenkins > Configure System
  10. Go to Team Foundation Server > TF command line executable and put the path in to tf.
  11. Back on the machine, Install Xcode and Command Line Tools (Xcode > Preferences)
  12. Install Xamarin Studio
  13. Activate Xamarin Studio on the Jenkins account
    • To do this you will need to:
      1. Go to System Preferences > Users & Groups > Select the standard user without a name
      2. (Optional) Give this user a name, I used Jenkins
      3. Change the password of this user
      4. Switch to the Jenkins user
      5. Open any solution in xamarin studio
      6. Select Project > Profile - Mono (this will cause Xamarin Studio to activate)

Setup a build

  1. In the Jenkins web interface select New Job.
  2. Give the job a name
  3. Select the Build multi-configuration project and click OK
  4. Scroll down to the Source Code Management section and select Team Foundation Server.
  5. Setup a Build Trigger for Poll SCM which will only build on check-in. You can use to help to see the format but an example that checks every 10 minutes is: H/10 * * * *
  6. In the Build section, Add a build step to Execute shell.
  7. Give in the following command: bash -ex /Users/Shared/Build/Scripts/BuildScript.sh where this is the path to the script and the name of it. There are some scripts in source.
  8. Save the build


Test the build

  1. Go to the main page and click the clock with the arrow in the right hand side of the grid out from where the build is.
  2. You should shortly see the build appear in the left hand side of the page under the menu. Once it appears click on it.
  3. Click on the Console Output menu item to watch what the build is doing.
  4. It should make it to the "Triggering" step. In this instance our trigger will be "default". Click on that link.
  5. Under Build History, in the left hand side click the currently running build, which is also the top build.
  6. Click on Console output again to see what this step is doing.
  7. The last line that is output should show SUCCESS.


What to Do if the Build is Failing

  1. Check the Console Output for the error messages. There were various issues and fixes I ran across trying to get this setup.
  2. If you're having a source control mapping issue, you might need to remove the workspace mentioned in the error via command line.
    • To do this you will need to use tf.
    • Navigate to the location of it or simply type in the path. Here's a sample of the command to run: ./tf workspaces -remove:WORKSPACE_NAME
  3. If you're having other, maybe seemingly random issues, verify that the Jenkins user has access to the folders it's trying to use.

    Notes

    This is a very simple and straightforward approach to building an application. There is a lot more you can do that I have not mentioned here. This is a basic tutorial to get you started using the build server. I strongly recommend setting up CI as it will help in many ways.


    Instructions are loosely based off on an MSDN article.