Skip to content

Commit

Permalink
Improve GettingStarted docs. DevCheck verify RS5 SDK. (#4411)
Browse files Browse the repository at this point in the history
* Updated GettingStarted docs about using winget to install RS5 SDK. Added RS5 SDK check to DevCheck

* Fixed some global variable references

* Added pointer where to go to fix a missing Windows SDK
  • Loading branch information
DrusTheAxe committed May 15, 2024
1 parent fd29314 commit 7d495a2
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 42 deletions.
13 changes: 10 additions & 3 deletions docs/Coding-Guidelines/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
99 changes: 60 additions & 39 deletions eng/common/DevCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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..."
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -589,7 +609,7 @@ function Repair-DevTestPfx
else
{
Write-Host "Create $f...Error"
$global:issues += 1
$global:issues++
$ok = $false
}
}
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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'
}

Expand All @@ -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
Expand All @@ -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
}

Expand All @@ -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
Expand All @@ -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
}

Expand All @@ -876,7 +896,7 @@ function Start-TAEFService
if ($service.Status -ne "Running")
{
Write-Host "Start TAEF service...Failed"
$global:issues += 1
$global:issues++
}
else
{
Expand All @@ -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
}

Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 7d495a2

Please sign in to comment.