问题
We are executing all the VB projects using below NANT script:Just example
<target name="VBCompile" >
<property name="failure.reason" value="VBCompile" />
<trycatch>
<try>
<foreach item="File" property="FileName" in="${VBProj.dir}">
<echo message="Creating Dll from: $:{FileName}" />
<exec basedir=${VBProj.dir} program=${VB6.exe} commandline=/MAKE ${FileName} outdir ${VBDll.dir}
</foreach>
</try>
<catch>
<fail message="${failure.reason}"/>
</catch>
<finally>
//..some codes
</finally>
</trycatch>
</target>
I want the scenario if we encountered some error while executing all VB projects, it should display the errors in Command Prompt itself and i don't want the error message to be dispalyed as alerts. I have tried using and ${failure.message}.Not working for me :( Please suggest any solution.
回答1:
Use the /out filename
command line argument to the VB6 IDE/compiler to give a filename which will receive error messages.
You can explore the other command line options with the /?
command line option.
来源:https://stackoverflow.com/questions/24084562/how-to-catch-errors-while-executing-vb-project-using-nant