當我使用批處理文件調用msbuild.exe時,日誌功能正常工作。當通過PowerShell執行時,Msbuild日誌不起作用
但是,當它寫在PowerShell中,它不記錄任何東西。
以下是我正在使用的powershell腳本。任何想法如何解決這個問題?
# Script to invoke build
. ./vsvars32.ps1
Remove-Item "ViewBuild1.log"
$MsbuildBinPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
$errorLogFileName="ViewBuild1Errors.log"
$buildLogFileName="ViewBuild1.log"
$MSBuildLogger="/flp1:Append;LogFile=ViewBuild1.log;Verbosity=Normal; /flp2:LogFile=ViewBuild1Errors.log;Verbosity=Normal;errorsonly"
$MSBuildFile="Build.Targets"
Write-Host --------------------------------------------
Write-Host Prepare for the build
Write-Host --------------------------------------------
&"$MsbuildBinPath\Msbuild.exe" $MSBuildFile "/t:Prepare" "$MSBuildLogger"
if ($LastExitCode -ne 0) {
Write-Host "It failed, send a mail"
}
#$LastExitCode
&"$MsbuildBinPath\Msbuild.exe" $MSBuildFile "/t:BuildAll" "$MSBuildLogger"
Viewbuild1.log執行後根本沒有任何內容,儘管我在filelogger中使用了append選項。
感謝它現在適合我。 – Samselvaprabu 2011-12-16 07:30:35