【问题标题】:NAnt stops working on Windows Server 2012, throws Unhandled Exception: System.Reflection.TargetInvocationExceptionNAnt 在 Windows Server 2012 上停止工作,抛出未处理的异常:System.Reflection.TargetInvocationException
【发布时间】:2015-08-11 16:38:12
【问题描述】:

我在 SO 上找不到这个确切的问题,唯一的解决方案是取消阻止文件。在我的场景中,整个 nant 目录被解锁(使用 PS),但我仍然得到以下异常:

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object, System.Object'.
   at NAnt.Core.ConsoleDriver.Main(String[] args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at NAnt.Console.ConsoleStub.HelperArguments.CallConsoleRunner()
   at NAnt.Console.ConsoleStub.Main(String[] args)

有几点要提:

1) 我在本地机器上从 GitHub 项目 (https://github.com/nant/nant) 的 HEAD 修订版编译了这个 .exe,并遇到了Nant failing with bad permissions on build server 中描述的相同“取消阻止”问题,为此我使用了 streams.exe 答案用于解锁我本地机器上的整个 nant 目录。

2) 我在 Win2k12 实例上安装了 .NET 4.5 运行时。当我在本地机器上构建 exe 时(如第 1 点所述),我使用了 GitHub 自述文件中建议的 nmake 命令:

nmake -f Makefile.nmake install prefix="c:\Program Files" TARGET=net-4.0

具体来说,我将 TARGET 参数保留为“net-4.0”。我不确定这是否重要,因为我在 Wink2k12 服务器上运行更新版本。

非常感谢任何帮助!

【问题讨论】:

    标签: c# .net nant


    【解决方案1】:

    好的,所以我通过不从源代码构建并从 sourceforge (http://nant.sourceforge.net/) 下载最新发布的 zip 并执行以下操作来解决我的问题:

    1) 从 sourceforge 下载“nant-0.92-bin.zip”发行版

    2) 将压缩包复制到服务器

    3) 右键单击​​ zip,点击底部“常规”选项卡下的“取消阻止”按钮(如果不存在,则未阻止)

    4) zip 的提取内容

    完成这些步骤后,nant.exe 程序运行没有问题(目前)。我不确定这是否可以被认为是一个重复的问题,因为另一个似乎更倾向于 nunit2report contrib 工具。希望这对其他人有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-19
      • 2023-02-22
      • 2011-10-10
      • 2013-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多