The preferred way to develop applications with the Monobjc bridge is to use the MonoDevelop addins. But there are cases when it is not suitable: Continuous Integration, automatic bundling, etc.

In these cases, a script-based development process is to be used. One of the most used script-based environment is MSBuild which is available with the Mono runtime through the xbuild tool. Monobjc provides a set of MSBuild tasks and targets that are dedicated to Mac OS X development.

The following targets are provided for Cocoa application:

  • BundleManaged: bundle a Cocoa application with the managed parts.
  • BundleNative: bundle a Cocoa application as a redistributable.
  • Package: package a Cocoa application for distribution.

Here are some example of MSBuild use:

$> xbuild /t:BundleNative MyApp.csproj
$> xbuild /t:Package MyApp.csproj

If you have created the project with MonoDevelop, all the needed properties and targets are already set. If not, here are what you need to insert in the project file.

The MSBuild tasks and targets rely on the following properties:

<AssemblyName>ScriptingBridgeiCal</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MainNibFile>en.lproj\MainMenu.xib</MainNibFile>
<BundleIcon>Monobjc.icns</BundleIcon>
<MacOSArch>X86</MacOSArch>
<Archive>false</Archive>
<MacOSFrameworks>AppKit;Foundation;ScriptingBridge</MacOSFrameworks>
<MacOSVersion>MacOS105</MacOSVersion>
<MacOSApplicationType>CocoaApplication</MacOSApplicationType>
<SigningIdentity />
<ArchiveIdentity />
<AdditionalAssemblies />
<ExcludedAssemblies />
<AdditionalLibraries />

The Monobjc MSBuild targets must also be imported:

<Import Project="$(MSBuildBinPath)\Monobjc.CocoaApplication.targets" />