mfestra
mfestra

Reputation: 11

NAnt stops working on Windows Server 2012, throws Unhandled Exception: System.Reflection.TargetInvocationException

I couldn't find this exact question on SO, the only solution involves Unblocking a file. In my scenario, the entire nant directory is unblocked (using PS), but I still get the following exception:

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)

A couple of things to mention:

1) I compiled this .exe on my local machine from the HEAD revision of the GitHub project (https://github.com/nant/nant) and encountered the same "Unblock" issue described in Nant failing with bad permissions on build server, for which I used the streams.exe answer for unblocking the entire nant directory on my local machine.

2) I have the .NET 4.5 runtime installed on the Win2k12 instance. When I built the exe on my local machine (as stated in point 1), I used the suggested nmake command from the GitHub readme:

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

Specifically, I left the TARGET argument as "net-4.0". I'm not sure if this matters, since I'm running a newer version on the Wink2k12 server.

Any help is greatly appreciated!!

Upvotes: 0

Views: 324

Answers (1)

mfestra
mfestra

Reputation: 11

Ok, so I fixed my issue by NOT building from source and downloading the latest published zip from sourceforge (http://nant.sourceforge.net/) and doing the following:

1) Downloaded the "nant-0.92-bin.zip" distribution from sourceforge

2) Copied the zip to the server

3) Right-clicked on zip, clicked "Unblock" button under 'General' tab at the bottom (if it's not there, it's not blocked)

4) Extracted contents of zip

After doing these steps, the nant.exe program runs with no issues (yet). I'm not sure if this can be considered a duplicate question as the other seemed more slanted towards the nunit2report contrib tool. Hopefully this helps someone else!

Upvotes: 1

Related Questions