Gert, My mistake, I had assumed that "Invoking D:\data\Build\BuildHelperLib.dll : Acturis.HelperLib.XmlFileUtil.AttributeTransformXmlFile"
meant that AttributeTransformXmlFile was being called directly, but it was actually another method (Program.Main, which I presume is the default within .NET?), which then called it through reflection. I've fixed it so that it fails properly now. Thanks for your help - really appreciate it. Robin McKenzie acturis ltd | connected thinking ________________________________________ From: Gert Driesen [mailto:[EMAIL PROTECTED] Sent: 23 July 2008 16:22 To: Robin McKenzie; nant-developers@lists.sourceforge.net Subject: RE: [nant-dev] Setting message level output from <exec> programs Hey Robin, Your code looks ok, although it's hard to tell from that small fragment. Can you check whether you don't have failonerror set to false on the <exec> task? Gert From: Robin McKenzie [mailto:[EMAIL PROTECTED] Sent: woensdag 23 juli 2008 17:19 To: 'Gert Driesen'; nant-developers@lists.sourceforge.net Subject: RE: [nant-dev] Setting message level output from <exec> programs Gert, Many thanks for the suggestion - I've updated my code so that the top-level public method includes: try { CallSubMethod(params); } catch (Exception e) { Console.Write("TEST"); return -1; } I also added a throw inside one of the child methods, so that this catch would be triggered. The output in the log file was: <task name="exec"> <message level="Info"><![CDATA[Invoking D:\data\Build\BuildHelperLib.dll : Acturis.HelperLib.XmlFileUtil.AttributeTransformXmlFile(C:\dev_awestatic_svn\Build\BuildConfig\ConfigVarsAwe.xml, C:\dev_awestatic_svn\awe_all\awe.Content\Microsites\MicroSites.xml, d:\data\static\drop\2008.07.23.16.13\Config\TEST\website\MicroSites.xml, awe-MicroSites.config, TEST)...]]></message> <message level="Info"><![CDATA[TESTBuildHelper complete.]]></message> <duration>187.49880000000002</duration> </task> As you can see, the word "TEST" was included in the Info message, but the -1 returned didn't cause the build to fail - any ideas? Also, is Console.Write the correct method to use? Many Thanks, Robin McKenzie acturis ltd | connected thinking ________________________________________ From: Gert Driesen [mailto:[EMAIL PROTECTED] Sent: 23 July 2008 15:59 To: Robin McKenzie; nant-developers@lists.sourceforge.net Subject: RE: [nant-dev] Setting message level output from <exec> programs Hey Robin, Currently, the exec task will log all output that the external process writes to stderr as warnings. I don't think we should consider all output to stderr as actual errors. I'd suggest fixing your buildhelper to return a non-zero exit code when execution fails. Gert From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robin McKenzie Sent: woensdag 23 juli 2008 12:52 To: 'nant-developers@lists.sourceforge.net' Subject: [nant-dev] Setting message level output from <exec> programs Hi, I'm interested in finding out how an external program, run through the <exec program=""> NAnt command can produce <message> elements in the log file with a level other than "Warning". My build file contains: <exec program="${BuildHelper.exe}"> <arg value="-assembly:D:\data\Build\BuildHelperLib.dll"/> <arg value="-type:Acturis.HelperLib.XmlFileUtil"/> <arg value="-method:AttributeTransformXmlFile"/> <arg value="-param:${generateConfig.transform.XmlFile}"/> <arg value="-param:${generateConfig.source.XmlFile}"/> <arg value="-param:${generateConfig.outputConfigXmlFile}"/> <arg value="-param:${generateConfig.transform.Key}"/> <arg value="-param:${generateConfig.env}"/> </exec> And the output generated is: <task name="exec"> <message level="Info"><![CDATA[Invoking D:\data\Build\BuildHelperLib.dll : SNIP...]]></message> <message level="Warning"><![CDATA[Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.]]></message> <message level="Warning"><![CDATA[at Acturis.HelperLib.XmlAttributeTransform.ApplyAttributeValueOverride(SNIP)]]></message> <message level="Warning"><![CDATA[at Acturis.HelperLib.XmlAttributeTransform.TransformXml(SNIP)]]></message> <message level="Warning">Lots more warnings...</message> <duration>13296.7899</duration> </task> However, I wish for the build to break, and the Warnings above should be thrown as Errors. The BuildHelper.exe program was written for us by a contractor who has since left, but the code is fairly simple C#.NET code. The NullReferenceException has been thrown by the .NET framework, but I can't see how it has been determined to be a Warning rather than an Error. Alternatively, if I can set the <exec> to "failOnWarning" that would be a less satisfactory, but nonetheless workable solution. Any ideas would be much appreciated. Kind Regards, Robin McKenzie acturis ltd | connected thinking ________________________________________ Winner of Service Provider of the Year 2007 at the British Insurance Awards Winner of Service Provider of the Year 2006 at the Insurance Times Awards Please consider the environment before printing this e-mail This e-mail and any files transmitted with it are confidential and/or privileged and protected by the laws of copyright. They are for the intended recipient only. If you are not the intended recipient, you must not use, review, distribute, disclose, alter, print, copy, transmit or rely on this e-mail and any file transmitted with it. If you have received this e-mail and any file transmitted with it in error please notify the sender. Acturis Limited is registered in England and Wales. Registered Office: Courtyard Suite, 100 Hatton Garden, London, EC1N 8NX. Company Number: 3998084. ___________________________________________________________________________________ This message is privileged, confidential and is protected by the laws of copyright. If you have reason to believe that you are not the intended recipient, please let us know immediately at [EMAIL PROTECTED] This email has been scanned by the MessageLabs Email Security System. ___________________________________________________________________________________ ________________________________________ Winner of Service Provider of the Year 2007 at the British Insurance Awards Winner of Service Provider of the Year 2006 at the Insurance Times Awards Please consider the environment before printing this e-mail This e-mail and any files transmitted with it are confidential and/or privileged and protected by the laws of copyright. They are for the intended recipient only. If you are not the intended recipient, you must not use, review, distribute, disclose, alter, print, copy, transmit or rely on this e-mail and any file transmitted with it. If you have received this e-mail and any file transmitted with it in error please notify the sender. Acturis Limited is registered in England and Wales. Registered Office: Courtyard Suite, 100 Hatton Garden, London, EC1N 8NX. Company Number: 3998084. ___________________________________________________________________________________ This message is privileged, confidential and is protected by the laws of copyright. If you have reason to believe that you are not the intended recipient, please let us know immediately at [EMAIL PROTECTED] This email has been scanned by the MessageLabs Email Security System. ___________________________________________________________________________________ Winner of Service Provider of the Year 2007 at the British Insurance Awards Winner of Service Provider of the Year 2006 at the Insurance Times Awards Please consider the environment before printing this e-mail This e-mail and any files transmitted with it are confidential and/or privileged and protected by the laws of copyright. They are for the intended recipient only. If you are not the intended recipient, you must not use, review, distribute, disclose, alter, print, copy, transmit or rely on this e-mail and any file transmitted with it. If you have received this e-mail and any file transmitted with it in error please notify the sender. Acturis Limited is registered in England and Wales. Registered Office: Courtyard Suite, 100 Hatton Garden, London, EC1N 8NX. Company Number: 3998084. ___________________________________________________________________________________ This message is privileged, confidential and is protected by the laws of copyright. If you have reason to believe that you are not the intended recipient, please let us know immediately at [EMAIL PROTECTED] This email has been scanned by the MessageLabs Email Security System. ___________________________________________________________________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers