私はここからの回答を実装しようとしています: How to access error details in MSBuildメールエラー - ReadLinesFromFileは「別のプロセスによって使用されている」
> msbuild MyProject.proj /fl /flp:v=detailed;logfile=mylog.txt
<Target Name="ErrorEmail">
<ReadLinesFromFile
File="mylog.txt"
Lines="_ErrorLines"
/>
<Mail
SmtpServer="mysrv"
From="[email protected]"
To="[email protected]"
Subject="An error occured"
Body="Error details: @(_ErrorLines, '%0D%0A')"
/>
</Target>
はエレガントに見えるが、私はこのエラーを取得しています:
c:\AccuRev\Build_2012_01_02\MyApp\ErrorHandlers.targets(24,9): error MSB3501: Could not read lines from file "mylog.txt". The process cannot access the file 'c:\AccuRev\Build_2012_01_02\MyApp\mylog.txt' because it is being used by another process
それは目標ですか?私はエラーの私のログを電子メールしたい。あなたは正しいのですが、もちろんロックされています。私の質問は、それを働かせる方法です。 – NealWalters
私は自分の答えを改善しました:) – Ludwo
それが成功すれば、さらなるトリックはメールを送らないことでしょう。 – NealWalters