Skip to content

Commit

Permalink
Use 'Write-Host' instead of 'Write-Warning' in 'main.ps1' script to m…
Browse files Browse the repository at this point in the history
…ake sure the output is seen in different environments

This'll make sure that the output is displayed in PowerShell 5 developing environments, and when outputing Warnings/Errors in Runspaces.
  • Loading branch information
og-mrk committed Aug 28, 2024
1 parent 32877fe commit 0c4c483
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ try {
$sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader )
$readerOperationSuccessful = $true
} catch [System.Management.Automation.MethodInvocationException] {
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
Write-Host "We ran into a problem with the XAML code. Check the syntax for this control..." -ForegroundColor Red
Write-Host $error[0].Exception.Message -ForegroundColor Red

If ($error[0].Exception.Message -like "*button*") {
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
write-Host "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n" -ForegroundColor Red
}
} catch {
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." -ForegroundColor Red
}

if (-NOT ($readerOperationSuccessful)) {
Expand Down

0 comments on commit 0c4c483

Please sign in to comment.