I have a script package from Ant exec to compile CSharp code. The script package is structured as follows.
msbuild.exe %ARGS% echo %ERRORLEVEL%
Now that the task is running in Ant, I get the following result:
[exec] Time Elapsed 00:00:09.48 [exec] 0 BUILD FAILED C:\proj\build.xml:410: exec returned: 2
How is it possible that% ERRORLEVEL% is 0, but Ant exec gets return code 2? Is this error code set by default if the command does not return a code? Ant docs show:
error code 2 means 'no such program',
But obviously my batch file is executing correctly.
Update Using Ant Code
<target name="build.csharp" if="isWindowsPlatform"> <exec executable="cmd.exe" failOnError="true"> <arg value="/c"/> <arg value="build.csharp.bat" /> </exec> </target>
source share