views:

68

answers:

1

I'm trying to build a MonoTouch project using xbuild (on a Mac, clearly). Here's my xbuild project:

<Project DefaultTargets="Application" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    <PropertyGroup>
        <ApplicationProjectFilePath>..\TestApp\TestApp.csproj</ApplicationProjectFilePath>    
        <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
        <MonoTouchReferencePath>/Developer/MonoTouch/usr/lib/mono/2.1/</MonoTouchReferencePath>
    </PropertyGroup>

    <Target Name="Application">
        <MSBuild Projects="$(ApplicationProjectFilePath)" Targets="Rebuild" Properties="Configuration=AdHoc;Platform=iPhone;ReferencePath=$(MonoTouchReferencePath)" ToolsVersion="3.5"/>
    </Target>
</Project>

When I run this, I get the following warning:

/Library/Frameworks/Mono.framework/Versions/2.6.7/lib/mono/3.5/Microsoft.Common.targets:  warning : Found a conflict between : 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' and 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' reference.

How can I have xbuild reference v3.5 of the framework? As you'll see from the script, I've tried a number of approachs, none of which seem to be working.

[Also, I'm not sure why I have to explicitly reference the monotouch.dll library - given that it's referenced in the project file (TestApp.csproj). Any comments on that would also be appreciated.]

+1  A: 

MonoTouch uses a superset of the Silverlight framework, not 3.5, and there are currently no xbuild targets for MonoTouch and its framework version. Implementing this will require custom targets that override framework assembly resolution, like the Silverlight and MonoDroid targets.

For now, I suggest you use the build command of MonoDevelop's commandline tool, mdtool, i.e.

/Applications/MonoDevelop.app/Contents/MacOS/mdtool build
mhutch