diff --git a/build/PowerShellScripts/GenerateReportForCompileTimeError.ps1 b/build/PowerShellScripts/GenerateReportForCompileTimeError.ps1 index 0030bf06e..0fb8f28a6 100644 --- a/build/PowerShellScripts/GenerateReportForCompileTimeError.ps1 +++ b/build/PowerShellScripts/GenerateReportForCompileTimeError.ps1 @@ -56,7 +56,9 @@ Get-Content $logFile | ForEach-Object { $inBuildFailedSection = $false } } - +if (Test-Path $reportFile) { + $fileContent = Get-Content $reportFile + if ($fileContent.Length -gt 0) { # Define file paths $inputFile = "$directoryPath\DemoReport.txt" # Path to the input file $outputFile = "$directoryPath\DemoReportWithTitle.txt" # Path to the output file @@ -68,6 +70,8 @@ $processedLine = $false # Clear the output file if it already exists Clear-Content -Path $outputFile -ErrorAction Ignore + + # Read the input file line by line Get-Content $inputFile | ForEach-Object { $line = $_ @@ -202,7 +206,7 @@ Get-Content $input5 | ForEach-Object { $line = $_ # If the line contains "(s)", replace it with an empty line - if ($line -match "Warning\(s\)|Error\(s\)") { + if ($line -match "Warning\(s\)|Error\(s\)|MSB3822") { Add-Content -Path $output5 -Value "" } else { # Otherwise, write the line as it is @@ -230,4 +234,6 @@ Get-Content $input6 | ForEach-Object { # Write the modified or original line to the output file Add-Content -Path $output6 -Value $line +} +} } \ No newline at end of file