diff --git a/docs/Coding-Guidelines/GettingStarted.md b/docs/Coding-Guidelines/GettingStarted.md index 6a45674aa..db39f9480 100644 --- a/docs/Coding-Guidelines/GettingStarted.md +++ b/docs/Coding-Guidelines/GettingStarted.md @@ -5,9 +5,16 @@ Development requires the following installed tools... 1. Windows 10 SDK 10.0.17763.0 (RS5) - a. Browse to https://go.microsoft.com/fwlink/p/?LinkID=2033908 - b. Save the offered download `winsdksetup.exe` - c. Run winsdksetup.exe + +The SDK can be installed via winget: + + winget install Microsoft.WindowsSDK.10.0.17736 + +or via the browser: + +* Browse to https://go.microsoft.com/fwlink/p/?LinkID=2033908 +* Save the offered download `winsdksetup.exe` +* Run winsdksetup.exe **NOTE:** Visual Studio 2022 doesn't include this SDK but will use it if installed on the machine. diff --git a/eng/common/DevCheck.ps1 b/eng/common/DevCheck.ps1 index 29ca3a7cb..7aebb317c 100644 --- a/eng/common/DevCheck.ps1 +++ b/eng/common/DevCheck.ps1 @@ -131,6 +131,9 @@ $global:issues = 0 $global:isadmin = $null +$global:vswhere = '' +$global:vswhere_url = '' + $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 @@ -300,10 +303,10 @@ function Get-VSWhereOnline { return $null } - $vswhere_url = 'https://github.com/microsoft/vswhere/releases/download/3.1.1/vswhere.exe' - Write-Host "Downloading $vswhere from $vswhere_url..." - Write-Verbose "Executing: curl.exe --output $vswhere -L -# $vswhere_url" - $null = Start-Process curl.exe -ArgumentList "--output $vswhere -L -# $vswhere_url" -Wait -NoNewWindow -PassThru + $global:vswhere_url = 'https://github.com/microsoft/vswhere/releases/download/3.1.7/vswhere.exe' + Write-Host "Downloading $global:vswhere from $global:vswhere_url..." + Write-Verbose "Executing: curl.exe --output $path -L -# $global:vswhere_url" + $null = Start-Process curl.exe -ArgumentList "--output $path -L -# $global:vswhere_url" -Wait -NoNewWindow -PassThru } if (-not(Test-Path -Path $path -PathType Leaf)) @@ -314,8 +317,6 @@ function Get-VSWhereOnline } # Home of vswhere.exe: https://github.com/microsoft/vswhere -$vswhere = '' -$vswhere_url = '' function Get-VSWhere { Write-Verbose "Detecting vswhere.exe..." @@ -333,12 +334,11 @@ function Get-VSWhere if ([string]::IsNullOrEmpty($global:vswhere)) { Write-Host "ERROR: vswhere.exe not found" -ForegroundColor Red -BackgroundColor Black - $global:issues += 1 + $global:issues++ return $null } - Write-Verbose "Using $vswhere" - $global:vswhere = $vswhere + Write-Verbose "Using $global:vswhere" return $global:vswhere } @@ -370,18 +370,18 @@ function Run-Process([string]$exe, [string]$arguments, [Ref][string]$stderr, [in return $stdout } -$vspath = '' +$global:vspath = '' function Get-VisualStudio2022InstallPath { Write-Verbose "Detecting VisualStudio 2022..." - $vswhere = Get-VSWhere - if ([string]::IsNullOrEmpty($global:vswhere)) + $vswhere_exe = Get-VSWhere + if ([string]::IsNullOrEmpty($vswhere_exe)) { return $null } $args = " -latest -products * -version [17.0,18.0) -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath" - Write-Verbose "Executing $vswhere $args" - $path = Run-Process $vswhere $args + Write-Verbose "Executing $vswhere_exe $args" + $path = Run-Process $vswhere_exe $args $path = $path -replace [environment]::NewLine, '' Write-Verbose "Visual Studio 2022 detected at $path" $global:vspath = $path @@ -394,16 +394,16 @@ function Test-VisualStudioComponent [String]$versionRange ) - $vswhere = Get-VSWhere + $vswhere_exe = Get-VSWhere if ([string]::IsNullOrEmpty($global:vswhere)) { return 0 } $args = " -latest -products * -version $versionRange -requires $component -property productDisplayVersion" - Write-Verbose "Executing $vswhere $args" + Write-Verbose "Executing $vswhere_exe $args" try { - $value = Run-Process $vswhere $args -throwIfExitCodeIsFailure $true + $value = Run-Process $vswhere_exe $args -throwIfExitCodeIsFailure $true $path = $path -replace [environment]::NewLine, '' Write-Verbose "Visual Studio component $($component) = $($value)" return 0 @@ -456,6 +456,26 @@ function Test-VisualStudio2022Install return $ok } +function Test-WindowsSDKInstall +{ + param( + [String]$version + ) + + $regkey = "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\$version" + $found = Test-Path $regkey -PathType Container + if ($found) + { + Write-Verbose "Windows SDK $($version) = OK" + } + else + { + Write-Host "...ERROR: Windows SDK $($version) not found or valid. See [Getting Started doc's Tooling Prerequisites](https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/GettingStarted.md#tooling-prerequisites)" -ForegroundColor Red -BackgroundColor Black + $global:issues++ + } + return $found +} + function Test-DevTestPfx { if ($Clean -eq $true) @@ -468,7 +488,7 @@ function Test-DevTestPfx if (-not(Test-Path -Path $pfx_thumbprint -PathType Leaf)) { Write-Host "Test certificate thumbprint $pfx_thumbprint...Not Found" - $global:issues += 1 + $global:issues++ return $false } @@ -477,7 +497,7 @@ function Test-DevTestPfx if (-not(Test-Path -Path $cert_path)) { Write-Host "Test certificate for $pfx_thumbprint...Not Found" - $global:issues += 1 + $global:issues++ return $false } @@ -487,13 +507,13 @@ function Test-DevTestPfx if ($expiration -lt $now) { Write-Host "Test certificate for $pfx_thumbprint...Expired ($expiration)" - $global:issues += 1 + $global:issues++ return $false } elseif ($expiration -lt ($now + (New-TimeSpan -Days 14))) { Write-Host "Test certificate for $pfx_thumbprint...Expires soon ($expiration)" - $global:issues += 1 + $global:issues++ return $true } @@ -507,7 +527,7 @@ function Repair-DevTestPfx if ($isadmin -eq $false) { Write-Host "Test certificate .pfx...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return $false } @@ -526,7 +546,7 @@ function Repair-DevTestPfx if (-not(Test-Path -Path $CertPasswordFile -PathType Leaf)) { Write-Host "Test certificate file $CertPasswordFile...Not Found" - $global:issues += 1 + $global:issues++ return $false } $password = Get-Content -Path $CertPasswordFile -Encoding utf8 @@ -542,7 +562,7 @@ function Repair-DevTestPfx if ([string]::IsNullOrEmpty($password_plaintext)) { Write-Host "Test certificate .pfx...password parameter (-CertPassword | -CertPasswordFile | -CertPasswordUser) or prompting required" - $global:issues += 1 + $global:issues++ return $false } $password = ConvertTo-SecureString -String $password_plaintext -Force -AsPlainText @@ -589,7 +609,7 @@ function Repair-DevTestPfx else { Write-Host "Create $f...Error" - $global:issues += 1 + $global:issues++ $ok = $false } } @@ -626,7 +646,7 @@ function Test-DevTestCert if (-not(Test-Path -Path $cert_path)) { Write-Host "Test certificate $pfx_thumbprint thumbprint $thumbprint...Not Found" - $global:issues += 1 + $global:issues++ return $false } @@ -636,13 +656,13 @@ function Test-DevTestCert if ($expiration -lt $now) { Write-Host "Test certificate $thumbprint...Expired ($expiration)" - $global:issues += 1 + $global:issues++ return $false } elseif ($expiration -lt ($now + (New-TimeSpan -Days 14))) { Write-Host "Test certificate $thumbprint...Expires soon ($expiration)" - $global:issues += 1 + $global:issues++ return $false } @@ -656,7 +676,7 @@ function Repair-DevTestCert if ($isadmin -eq $false) { Write-Host "Install test certificate...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return } @@ -677,7 +697,7 @@ function Remove-DevTestCert if ($isadmin -eq $false) { Write-Host "Remove test certificate...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return $false } @@ -796,7 +816,7 @@ function Install-TAEFService if ($isadmin -eq $false) { Write-Host "Install TAEF service...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return } @@ -808,7 +828,7 @@ function Install-TAEFService if (-not(Test-Path -Path $path -PathType Leaf)) { Write-Host "Install TAEF service...Not Found ($path)" - $global:issues += 1 + $global:issues++ return 'TAEFNotFound' } @@ -818,7 +838,7 @@ function Install-TAEFService if ([string]::IsNullOrEmpty($service)) { Write-Host "Install TAEF service...Failed" - $global:issues += 1 + $global:issues++ return 'InstallError' } else @@ -834,7 +854,7 @@ function Uninstall-TAEFService if ($isadmin -eq $false) { Write-Host "Uninstall TAEF service...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return } @@ -851,7 +871,7 @@ function Uninstall-TAEFService if (-not([string]::IsNullOrEmpty($service))) { Write-Host "Uninstall TAEF service...Failed" - $global:issues += 1 + $global:issues++ return 'UninstallError' } else @@ -867,7 +887,7 @@ function Start-TAEFService if ($isadmin -eq $false) { Write-Host "Install TAEF service...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return } @@ -876,7 +896,7 @@ function Start-TAEFService if ($service.Status -ne "Running") { Write-Host "Start TAEF service...Failed" - $global:issues += 1 + $global:issues++ } else { @@ -891,7 +911,7 @@ function Stop-TAEFService if ($isadmin -eq $false) { Write-Host "Stop TAEF service...Access Denied. Run from an admin prompt" - $global:issues += 1 + $global:issues++ return $false } @@ -912,7 +932,7 @@ function Stop-TAEFService elseif ($service.Status -ne "Stopped") { Write-Host "Stop TAEF service...Failed" - $global:issues += 1 + $global:issues++ return $false } else @@ -1334,6 +1354,7 @@ if (($CheckAll -ne $false) -Or ($CheckVisualStudio -ne $false)) { $null = Test-VisualStudioComponents } + $null = Test-WindowsSDKInstall '10.0.17763.0' } if (($CheckAll -ne $false) -Or ($CheckTestPfx -ne $false))