如何使 Mono 的 xbuild 中的 MSBuild 任务使用 .NET 3.5 框架?
我正在尝试使用 xbuild 构建一个 MonoTouch 项目(显然是在 Mac 上)。这是我的 xbuild 项目:
<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>
当我运行此项目时,我收到以下警告:
/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?正如您将从脚本中看到的,我尝试了多种方法,但似乎都不起作用。
[此外,我不确定为什么必须显式引用 monotouch.dll 库 - 鉴于它在项目文件 (TestApp.csproj) 中引用。任何对此的评论也将不胜感激。]
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.]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MonoTouch 使用 Silverlight 框架的超集,而不是 3.5,并且目前没有 MonoTouch 及其框架版本的 xbuild 目标。实现此功能需要覆盖框架程序集解析的自定义目标,例如 Silverlight 和 MonoDroid 目标。
目前,我建议你使用MonoDevelop的命令行工具mdtool的build命令,即
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.