|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Setting message level output from <exec> programsHi, 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, 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 info@... 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@... https://lists.sourceforge.net/lists/listinfo/nant-developers |
|
|
Re: Setting message level output from <exec> programsHey 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:
nant-developers-bounces@...
[mailto:nant-developers-bounces@...] On Behalf Of Robin
McKenzie 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 ------------------------------------------------------------------------- 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@... https://lists.sourceforge.net/lists/listinfo/nant-developers |
|
|
|
|
|
|
| Free Forum Powered by Nabble | Forum Help |