How to build Xamarin.Mac application from command line or build script

1.1k views Asked by At

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.

2

There are 2 answers

0
Iain Smith On BEST ANSWER

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

4
Pavel Anpin On

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