0
msbuild MyProject.proj /fl /flp:v=detailed;logfile=mylog.txt
msbuild MyProject.proj /t:ErrorEmail
我已經實現了這一點,它有錯誤時工作。 但是,當沒有錯誤時它也會發送電子郵件。 如果文件爲空,或者ReadLinesFromFile中有0行數,我該如何設置條件?電子郵件MSBuild錯誤 - 只有當有錯誤
> <Target Name="ErrorEmail">
> <ReadLinesFromFile
> File="mylog.txt"
> Lines="_ErrorLines"
> />
> <MSBuild.Community.Tasks.Mail
> SmtpServer="mailhost.amsa.com"
> To="$(ErrorEmails)"
> From="$(FromEmail)"
> Subject="Build failure for $(SolutionName)"
> Body="Error details: @(ErrorFileContents, '%0D%0A')"
> />
> </Target>
是CreateProperty 4.0功能嗎?我在3.5上,並得到這個錯誤:「元素下的元素無法識別」 –
NealWalters
2012-01-11 16:31:53
啊 - 看起來它必須在目標下。 – NealWalters 2012-01-11 16:33:19