【问题标题】:NAnt platform errorNAnt 平台错误
【发布时间】:2012-06-21 19:42:18
【问题描述】:

我已经完成了 .build 设置

<csc platform='x86' target='winexe' output='${validate.file}' debug='${debug}' warnaserror='true'>

但我明白了

  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'System.Data.dll' targets a different processor
  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'System.Data.OracleClient.dll' targets a different processor
  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'System.EnterpriseServices.dll' targets a different processor
  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'System.Transactions.dll' targets a different processor
  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'System.Web.dll' targets a different processor
  [csc] error CS1607: Warning as Error: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor

External Program Failed: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe (return code was 1)

当我使用 NAnt .92 时。如果我使用 NAnt .91 一切正常。如何更新我的 .build 以使用 .92?我在 Win7 64Bit 上构建。

在具有完全相同的 .build 文件的 NAnt .91 下,使用的外部程序是 C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe。注意框架,而不是 Framework64。它看起来像nant .92在选择plateform='x86'时使用错误的框架。

【问题讨论】:

标签: nant


【解决方案1】:

一个简单的解决方法是像这样修改您的 csc 任务:

<csc platform='x86' target='winexe' output='${validate.file}' debug='${debug}' warnaserror='true'>
    <warnaserror>
        <exclude number="1607" />
    </warnaserror>

这样您仍然会收到错误警告(我猜这是您想要的),但尤其是 CS1607。也许这是您可以接受的妥协?

这确实是一个有趣的问题。深入研究 NAnt.exe.config,我看到框架“net-4.0”的定义总是在以下位置查找其程序集:

frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}"
frameworkassemblydirectory="${path::combine(installRoot, 'v4.0.30319')}"

并且 installRoot 来自注册表,它始终具有值 Framework64。这意味着当您定位“net-4.0”时,您已经选择了 Framework64 文件夹。当您在 csc 任务中指定它应该使用 x86 时,为时已晚。

一个不错且大胆的实验是在 NAnt.exe.config 中创建一个新的框架定义,将 net-4.0 复制到 net-4.0-x86 中。然后将该定义更改为以框架路径而不是 Framework64 为目标。它可能会起作用。当然,您需要告诉 nant 以 net-4.0-x86 为目标,您将拥有一个被黑的自定义 NAnt.exe.config 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多