3

We have a Xamarin.Mac application that is ready to be Continuously Integrated via TeamCity.

We have a build host on Mac machine where Xamarin Studio is installed. The next step is to create a build step in a build configuration.

Unlike VS, Xamarin Studio doesn't seem to have a Xamarin.Studio runner for TeamCity. Thus as articles on Xamarin Wiki recommend, one should use build scripts, like Rake.

I, being a .Net dev, has spent a day learning Rake and I unfortunately don't like it.

Another thing is I don't know which command would build my .sln file given that I reuse some of the Rakefile's I've found online. Please tell me what is the command to build .sln in Xamarin Studio for Mac.

Thank you.

Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174

2 Answers2

2

Here is a command which works for me

msbuild MySolution.sln /t:"MySolution_MyMacProject" /p:Configuration="Release"

Keep in mind that you need replace some specific characters like . in the target or configuration names with the _ as mentioned here

  • What is /t here – Rajasekar Sep 07 '21 at 09:43
  • /t stands for target which is your project inside solution – Pavel Anpin Sep 08 '21 at 10:07
  • When you do this do you have to do any signing yourself? Also, what file do you actually distribute to your team as a result of the build? I have the same need as the OP of TeamCity Xamarin.Mac build. I need this for QA testing. Thanks in advance. – spaceagestereo Feb 23 '22 at 13:56
  • @spaceagestereo presuming your app builds you will get a valid Mac app which you have to sign yourself via [xcrun altool](https://keith.github.io/xcode-man-pages/altool.1.html). For your specific case you probably want to notarize the app, pack into dmg, notarize it as well and then distribute it as a usual drag and drop macOs installer. – Pavel Anpin Feb 23 '22 at 15:20
1

We are using Jenkins with a bash script but the command we call is mdtool like so

/Applications/Xamarin Studio.app/Contents/MacOS/mdtool build -p:"PROJECT_NAME" -t:Build -c:"RELEASE_TYPE" "SOULTIONFILE.sln"

Just seen this too on the Xamarin forums about Mac build automation

Iain Smith
  • 9,230
  • 4
  • 50
  • 61