From 4e0c9006f847b2132bc1273c77db4946a3ba7625 Mon Sep 17 00:00:00 2001 From: Howard Kapustein Date: Wed, 17 Jan 2024 23:29:58 -0800 Subject: [PATCH] Added -ShowSystemInfo to aid troubleshooting (#4087) --- .../WindowsAppSDK-RunTests-Steps.yml | 4 +- ...dowsAppSDK-SetupBuildEnvironment-Steps.yml | 2 +- eng/common/DevCheck.ps1 | 48 ++++++++++++++++++- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml index 4f1cd2923..7030664d9 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml @@ -11,7 +11,7 @@ steps: inputs: targetType: filePath filePath: eng\common\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean -CheckDependencies + arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean -CheckDependencies -ShowSystemInfo workingDirectory: '$(Build.SourcesDirectory)' - task: DownloadPipelineArtifact@2 @@ -94,7 +94,7 @@ steps: inputs: targetType: filePath filePath: eng\common\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -CheckTAEFService + arguments: -NoInteractive -Offline -Verbose -CheckTAEFService -ShowSystemInfo workingDirectory: '$(Build.SourcesDirectory)' - task: VisualStudioTestPlatformInstaller@1 diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml index e91f72239..67cdca641 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml @@ -72,7 +72,7 @@ steps: inputs: targetType: filePath filePath: eng\common\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean -CheckDependencies + arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean -CheckDependencies -ShowSystemInfo workingDirectory: '$(Build.SourcesDirectory)' - task: PowerShell@2 diff --git a/eng/common/DevCheck.ps1 b/eng/common/DevCheck.ps1 index 1289f0cf7..b19d44f74 100644 --- a/eng/common/DevCheck.ps1 +++ b/eng/common/DevCheck.ps1 @@ -58,6 +58,9 @@ .PARAMETER RemoveTestPfx Remove the MSIX Test signing certificate (i.e. undoc CheckTestPfx) +.PARAMETER ShowSystemInfo + Display system information + .PARAMETER StartTAEFService Start the TAEF service @@ -109,6 +112,8 @@ Param( [Switch]$RemoveTestPfx=$false, + [Switch]$ShowSystemInfo=$false, + [Switch]$StartTAEFService=$false, [Switch]$StopTAEFService=$false, @@ -127,7 +132,10 @@ $global:issues = 0 $global:isadmin = $null $remove_any = ($RemoveAll -eq $true) -or ($RemoveTestCert -eq $true) -or ($RemoveTestCert -eq $true) -if (($remove_any -eq $false) -And ($CheckTAEFService -eq $false) -And ($StartTAEFService -eq $false) -And ($StopTAEFService -eq $false) -And ($CheckTestCert -eq $false) -And ($CheckTestPfx -eq $false) -And ($CheckVisualStudio -eq $false) -And ($CheckDependencies -eq $false) -And ($SyncDependencies -eq $false) -And ($CheckDeveloperMode -eq $false)) +if (($remove_any -eq $false) -And ($CheckTAEFService -eq $false) -And ($StartTAEFService -eq $false) -And + ($StopTAEFService -eq $false) -And ($CheckTestCert -eq $false) -And ($CheckTestPfx -eq $false) -And + ($CheckVisualStudio -eq $false) -And ($CheckDependencies -eq $false) -And ($SyncDependencies -eq $false) -And + ($CheckDeveloperMode -eq $false) -And ($ShowSystemInfo -eq $false)) { $CheckAll = $true } @@ -1280,6 +1288,39 @@ function Test-DeveloperMode } } +function Get-SystemInfo +{ + $regkey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' + $productname = $(Get-Item -Path $regkey).GetValue('ProductName') + $displayversion = $(Get-Item -Path $regkey).GetValue('DisplayVersion') + $currentmajor = $(Get-Item -Path $regkey).GetValue('CurrentMajorVersionNumber') + $currentminor = $(Get-Item -Path $regkey).GetValue('CurrentMinorVersionNumber') + $currentbuild = $(Get-Item -Path $regkey).GetValue('CurrentBuild') + Write-Host "Product : $($productname) $($displayversion) $($currentmajor).$($currentminor).$($currentbuild)" + + $installationtype = $(Get-Item -Path $regkey).GetValue('InstallationType') + Write-Host "InstallationType: $($installationtype)" + + $editionid = $(Get-Item -Path $regkey).GetValue('EditionId') + $compositioneditionid = $(Get-Item -Path $regkey).GetValue('CompositionEditionID') + if ($editionid -eq $compositioneditionid) + { + Write-Host "Edition : $($editionid)" + } + else + { + Write-Host "Edition : $($editionid) [$($compositioneditionid)]" + } + + $buildlabex = $(Get-Item -Path $regkey).GetValue('BuildLabEx') + Write-Host "Build : $($buildlabex)" + + $lcuver = $(Get-Item -Path $regkey).GetValue('LCUVer') + Write-Host "LCU Version : $($lcuver)" + + Write-Host "Powershell : $($PSVersionTable.PSEdition) $($PSVersionTable.PSVersion)" +} + Write-Output "Checking developer environment..." $cpu = Get-CpuArchitecture @@ -1288,6 +1329,11 @@ Write-Verbose("Processor...$cpu") $project_root = Get-ProjectRoot Write-Output "Windows App SDK location...$project_root" +if (($CheckAll -ne $false) -Or ($ShowSystemInfo -ne $false)) +{ + Get-SystemInfo +} + if (($CheckAll -ne $false) -Or ($CheckVisualStudio -ne $false)) { $ok = Test-VisualStudio2022Install