如何使 Mono 的 xbuild 中的 MSBuild 任务使用 .NET 3.5 框架?

发布于 2024-09-19 00:07:42 字数 1424 浏览 3 评论 0 原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酷遇一生 2024-09-26 00:07:42

MonoTouch 使用 Silverlight 框架的超集,而不是 3.5,并且目前没有 MonoTouch 及其框架版本的 xbuild 目标。实现此功能需要覆盖框架程序集解析的自定义目标,例如 Silverlight 和 MonoDroid 目标。

目前,我建议你使用MonoDevelop的命令行工具mdtool的build命令,即

/Applications/MonoDevelop.app/Contents/MacOS/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.

/Applications/MonoDevelop.app/Contents/MacOS/mdtool build
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文