0

我正在尝试创建一个自定义任务来生成一个中间 .csproj 文件(请参阅这篇文章了解原因。)

自定义任务位于当前引用 .net 2.0 程序集的 dll 中。

启用 MonoDevelop的实验性 msbuild/xbuild设置以强制 MonoDevelop 使用 xbuild 构建项目。

<UsingTask>我可以通过一个通过元素引用任务的项目从命令行运行它:

    ~/src/All/workspace/XBuildExt/bin/Debug> 单声道
    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/3.5/xbuild.exe
    ../../XBuildExtTest.targets
    XBuild 引擎版本 2.10.8.0
    单声道,版本 2.10.8.0
    版权所有 (C) Marek Sieradzki 2005-2008,Novell 2008-2011。

    构建开始于 2012 年 2 月 27 日下午 4:26:15。
    __________________________________________________
    项目“/Users/bright/src/All/workspace/XBuildExt/XBuildExtTest.targets”        
    (默认目标):
        目标构建:
            有用!
    完成建设项目
    “/Users/bright/src/All/workspace/XBuildExt/XBuildExtTest.targets”。

    构建成功。
         0 个警告
         0 错误

但是,MonoTouch 项目中的相同代码失败:

    初始化任务 GenerateMdToolProject 时出错:无法从
    源类型到目标类型。
    任务“GenerateMdToolProject”执行——失败

问题:

  1. I've found this old post which indicates the problem was fixed in Mono 2.8. Is this also true of MonoTouch?
  2. Can I use .net 3.5 functionality (in particular System.Xml.Linq) for coding the custom task?
4

2 回答 2

0

MonoDevelop doesn't use xbuild to build MonoTouch project, but custom code which only understands as much as necessary of the MSBuild project file.

This means that any special MSBuild logic you add to the project will go undetected.

There are plans for this to change in the future, but nothing has been decided (nor is there a timeline) yet.

于 2012-02-27T11:40:56.127 回答
0

I've found this old post which indicates the problem was fixed in Mono 2.8.

You misunderstood that post. It says this was fixed in MonoDevelop (not Mono) in early September 2010. So recent versions of MonoDevelop, like 2.8.x, will have the fix you mention.

The note about Mono 2.8 is about another requirement (of the original post question), i.e. having a runtime that supports .NET 4.0. You'll only have this if you're using Mono 2.8 (or later). Developing for MonoTouch requires Mono 2.10+ so this won't be an issue for you.

Is this also true of MonoTouch?

This does not apply to MonoTouch itself. The Mono version used inside the product (based on 2.10 anyway) is not what you use (except the smcs compiler) to execute MonoDevelop or (in your case) the xbuild (Mono's msbuild-compatible) tool.

IWO the parts of Mono that are included in MonoTouch are meant to be used on the simulator or device, not for building or executing the tooling.

Can I use .net 3.5 functionality (in particular System.Xml.Linq) for coding the custom task?

Yes. Once you have a .NET 4.0 runtime you'll have (thru the GAC) access the newer assemblies, including System.Xml.Linq, to run your msbuild tasks (as long as your paths and environment variables are set correctly, which they likely are if can run MonoDevelop).

于 2012-02-28T00:17:06.827 回答