2

使用MonoDevelop 5.1.0编译解决方案和通过调用XBuild的Cake脚本编译相同的解决方案时,我得到了不同的行为。

使用 MonoDevelop 编译解决方案时,一切正常。通过我的蛋糕脚本编译时,我收到以下错误:

System.IDisposable' 类型是在未引用的程序集中定义的。考虑添加对程序集 System.Runtime、Version=4.0.0.0、Culture=neutral、PublicKeyToken=b03f5f7f11d50a3a' 的引用

这种不同行为的原因可能是什么?

蛋糕脚本没有做任何花哨的事情。它只是用完全相同的解决方案调用 XBuild。

我的环境(在 Fedora 23 上):

mono --version
Mono JIT compiler version 4.4.0 (Stable 4.4.0.142/81f38a9 Thu Apr 28 09:14:25 EDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

XBuild Version:
XBuild Engine Version 14.0
Mono, Version 4.4.0.0
Copyright (C) 2005-2013 Various Mono authors
4

1 回答 1

4

您可以尝试不使用 XBuild 别名来使用Cake.Xamarin插件,该插件为mdtool提供MDToolBuild别名,该插件使用没有 GUI 的 Monodevelop 来编译您的解决方案。

public static void MDToolBuild(
       FilePath projectOrSolutionFile,
       Action<MDToolSettings> settings
)

Cake 脚本中的示例用法:

#addin "Cake.Xamarin"

MDToolBuild(
   "./mySolution.sln",
   settings=> { settings.Configuration = "Debug"; },
);
于 2016-06-02T11:25:07.817 回答