问题描述
我正在尝试使用xbuild(显然是在Mac上)构建MonoTouch项目.这是我的xbuild项目:
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.
如何获得该框架的xbuild参考v3.5?正如您从脚本中看到的那样,我尝试了许多方法,但似乎都没有用.
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.
[此外,我不确定为什么必须显式引用monotouch.dll库-鉴于它已在项目文件(TestApp.csproj)中进行了引用.任何对此的评论也将不胜感激.]
[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.]
推荐答案
MonoTouch使用Silverlight框架的超集而不是3.5,并且MonoTouch及其框架版本目前没有xbuild目标.要实现此目标,需要使用覆盖框架装配分辨率的自定义目标,例如Silverlight和MonoDroid目标.
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.
现在,我建议您使用MonoDevelop的命令行工具mdtool的build命令.
For now, I suggest you use the build command of MonoDevelop's commandline tool, mdtool, i.e.
/Applications/MonoDevelop.app/Contents/MacOS/mdtool build
这篇关于如何使Mono的xbuild中的MSBuild任务使用.NET 3.5框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!