【问题标题】:xbuild error in NUnit when compiling from clean build outside of Xamarin从 Xamarin 外部的干净构建编译时 NUnit 中的 xbuild 错误
【发布时间】:2015-10-26 17:36:37
【问题描述】:

我正在 Mac OS X 上的 Xamarin 中构建命令行工具。一般来说,我的工作流程是在 Xamarin Studio 中构建和测试。然后我有一个在命令行上构建的发布构建脚本,使用:

xbuild /p:Configuration=Release myTool.sln

但是,我从单元测试子项目中的文件中得到错误,而我在正常构建项目时没有得到:

Tests.cs(13,6): error CS1729: The type `NUnit.Framework.TestFixtureAttribute' does not contain a constructor that takes `1' arguments
Tests.cs(14,6): error CS1729: The type `NUnit.Framework.TestFixtureAttribute' does not contain a constructor that takes `1' arguments
Tests.cs(759,20): error CS0117: `NUnit.Framework.Assert' does not contain a definition for `Throws'

请注意,这仅在从干净项目构建时,从 git 新鲜同步。只要我在 Xamarin Studio 中打开解决方案并从那里构建,命令行构建脚本就会正常工作。

Xamarin 正在做的事情我也应该在命令行上做吗?

【问题讨论】:

  • 我将使用 xbuild 和 Xamarin Studio 运行诊断构建,看看它们是否都使用相同的 NUnit 程序集。我猜是选错了,可能是 Mono 附带的旧版本。
  • 感谢@MattWard!情况似乎确实如此。找到了解决方案并在此处发布了我自己的问题的答案。

标签: c# macos xamarin nunit xbuild


【解决方案1】:

原来我在某个地方(Xamarin 自己的?)使用默认的.gitignore,忽略了packages 目录。从 Xamarin Studio 中运行时这很好,因为它会自动下载所需的包。

通过在我们的存储库中保留正确版本的 NUnit,这意味着不首先运行 Xamarin 的团队成员能够正常构建该工具。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 2018-11-15
    • 2011-10-10
    • 1970-01-01
    • 1970-01-01
    • 2015-09-25
    相关资源
    最近更新 更多