How do I make the MSBuild task in Mono's xbuild use the .NET 3.5 framework?

不羁岁月 提交于 2019-12-11 09:29:12

问题


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">
    <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:


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


来源:https://stackoverflow.com/questions/3695233/how-do-i-make-the-msbuild-task-in-monos-xbuild-use-the-net-3-5-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!