2

次のように、nant 構成ファイルの「try-catch」セクションでアプリケーションをビルドする必要があります。

<trycatch>
        <try>
         <echo message="Start building MyApplication.."/>
         <call target="BuildApp"/>
        </try>
        <catch>
         <echo message="Build MyApp.sln is failed"/>
         <fail/>
        </catch>
</trycatch>

ビルドが失敗すると、「ビルド MyApp.sln が失敗しました」というメッセージのみが表示され、失敗した理由の詳細情報は表示されません。ビルド エラーを「catch」セクションにリダイレクトし、失敗の理由を確認するにはどうすればよいですか?

4

1 に答える 1

3

タグにproperty属性を追加する必要があります。catch

<trycatch>
  <try>
    <echo message="Start building MyApplication.."/>
    <call target="BuildApp"/>
  </try>
  <catch property="failure.message">
    <echo message="Build MyApp.sln is failed"/>
    <echo message="Failure message: ${failure.message}"/>
    <fail />
  </catch>
</trycatch>

を介して失敗メッセージを転送することもできます<fail message="${failure.message}" />

于 2012-11-27T11:45:46.767 に答える