How to build MonoTouch Project using mdtool

2019-05-13 19:01发布

问题:

I'm trying to set up a MonoTouch (Xamarin.iOS 2.0) project on a Jenkins build. I have a user that I have set up for the build, and I have added all of the required certificates and keys to their keychain.

When I attempt to use the mdtool (as described here and here) in the Terminal. Specifically Specifically, the command I run is "/Applications/Xamarin Studio.app/Contents/MacOS/mdtool" -v build <path to .sln>. When I do this, I get this output

MonoDevelop Build tool
ERROR [2013-02-28 10:31:36Z]: Android SDK not found, needed by Xamarin.Android add in 
Loading solution: <path to .sln>
   Loading solution: <path to .sln>
      Loading projects ..
Building Solution: <Project name> (Ad-Hoc|iPhone)
   Building: <project name> (Ad-Hoc|iPhone)

At this point, the build stops. If I run this same command under my own user, and not the Jenkins user, this works as expected. I've checked that I do in fact have all of the certificates and keys in the jenkins user, and that all of the Provisioning Profiles are accessible through XCode. I'm kind of at wits end with this, and would really appreciate some help.

To make matters more confusing, if I attempt to build this project using Xamarin Studio under the jenkins user, the process succeeds without issue. But to automate the build process, I have to make a command that can run through the shell.

回答1:

That's because the product license file is installed on your user account (where it works) but cannot be found under your build server account (where it does not work).

You'll need to copy the license file from:

/Users/***you username**/Library/MonoTouch/License.v2

to:

/Users/***your build server account**/Library/MonoTouch/License.v2

Note that the license of some editions of Xamarin.iOS (e.g. Starter and Indie) does not allow you to do this (so it might not work).