diff --git a/images/win/scripts/Installers/Install-WDK.ps1 b/images/win/scripts/Installers/Install-WDK.ps1 index 139f50c1..9528be45 100644 --- a/images/win/scripts/Installers/Install-WDK.ps1 +++ b/images/win/scripts/Installers/Install-WDK.ps1 @@ -4,34 +4,41 @@ ################################################################################ # Requires Windows SDK with the same version number as the WDK -if (Test-IsWin19) -{ +if (Test-IsWin22) { + # SDK available through Visual Studio + $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2196230" + $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\*\WDK.vsix" + $VSver = "2022" +} elseif (Test-IsWin19) { $winSdkUrl = "https://go.microsoft.com/fwlink/?linkid=2173743" $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2166289" $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix" $VSver = "2019" -} -elseif (Test-IsWin16) -{ +} elseif (Test-IsWin16) { $winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" $wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" $FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix" $VSver = "2017" -} -else -{ - throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required" +} else { + throw "Invalid version of Visual Studio is found. Either 2017,2019 or 2022 are required" } $argumentList = ("/features", "+", "/quiet") -# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI -Install-Binary -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList $argumentList +if ((Test-IsWin16) -or (Test-IsWin19)) { + # `winsdksetup.exe /features + /quiet` installs all features without showing the GUI + Install-Binary -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList $argumentList +} # `wdksetup.exe /features + /quiet` installs all features without showing the GUI Install-Binary -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList $argumentList # Need to install the VSIX to get the build targets when running VSBuild -Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly +# Windows 2022 - Skip installation due to a regression +# https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk +if ((Test-IsWin16) -or (Test-IsWin19)) { + $FilePath = Resolve-Path -Path $FilePath + Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly +} Invoke-PesterTests -TestFile "WDK" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index b085433c..a29f7e8c 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -54,9 +54,9 @@ function Get-VisualStudioExtensions { # SDK if (Test-IsWin19) { - $sdkPackageVersion = Get-SDKVersion + $sdkVersion = Get-SDKVersion $sdkPackages = @( - @{Package = 'Windows Software Development Kit Extension'; Version = $sdkPackageVersion} + @{Package = 'Windows Software Development Kit'; Version = $sdkVersion} ) } @@ -68,14 +68,21 @@ function Get-VisualStudioExtensions { ) # WDK - $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' - $wdkExtensionVersion = Get-WDKVersion + $wdkVersion = Get-WDKVersion + $wdkExtensionVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' $wdkPackages = @( - @{Package = 'Windows Driver Kit'; Version = $wdkPackageVersion} + @{Package = 'Windows Driver Kit'; Version = $wdkVersion} @{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion} ) } - + + if (Test-IsWin22) { + # WDK + $wdkVersion = Get-WDKVersion + $wdkPackages = @( + @{Package = 'Windows Driver Kit'; Version = $wdkVersion} + ) + } $extensions = @( $vsixs diff --git a/images/win/scripts/Tests/WDK.Tests.ps1 b/images/win/scripts/Tests/WDK.Tests.ps1 index 6c5dc329..b58d018a 100644 --- a/images/win/scripts/Tests/WDK.Tests.ps1 +++ b/images/win/scripts/Tests/WDK.Tests.ps1 @@ -1,11 +1,13 @@ -Describe "WDK" -Skip:(Test-IsWin22) { - It "WDK exists" { - $WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version - $WDKVersion| Should -Not -BeNullOrEmpty - } +Describe "WDK" { + It "WDK exists" { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + $WDKVersion = $installedApplications | Where-Object DisplayName -eq 'Windows Driver Kit' | Select-Object -First 1 -ExpandProperty DisplayVersion + $WDKVersion | Should -Not -BeNullOrEmpty + } - It "WDK version from system" { - $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" - $version | Should -Not -BeNullOrEmpty - } + It "Windows Driver Kit VSIX extension" -Skip:(Test-IsWin22) { + $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" + $version | Should -Not -BeNullOrEmpty + } } diff --git a/images/win/toolsets/toolset-2022.json b/images/win/toolsets/toolset-2022.json index c17f6aa7..add06167 100644 --- a/images/win/toolsets/toolset-2022.json +++ b/images/win/toolsets/toolset-2022.json @@ -199,6 +199,7 @@ "Microsoft.VisualStudio.Component.TestTools.CodedUITest", "Microsoft.VisualStudio.Component.TestTools.WebLoadTest", "Microsoft.VisualStudio.Component.UWP.VC.ARM64", + "Microsoft.VisualStudio.Component.UWP.VC.ARM64EC", "Microsoft.VisualStudio.Component.VC.CLI.Support", "Microsoft.VisualStudio.Component.VC.CMake.Project", "Microsoft.VisualStudio.Component.VC.DiagnosticTools", @@ -214,9 +215,13 @@ "Microsoft.VisualStudio.Component.VC.MFC.ARM", "Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre", "Microsoft.VisualStudio.Component.VC.ATL.ARM64", + "Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre", + "Microsoft.VisualStudio.Component.VC.ATL.ARM64EC", + "Microsoft.VisualStudio.Component.VC.ATL.ARM64EC.Spectre", "Microsoft.VisualStudio.Component.VC.MFC.ARM64", "Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre", "Microsoft.VisualStudio.Component.VC.MFC.ARM64EC", + "Microsoft.VisualStudio.Component.VC.MFC.ARM64EC.Spectre", "Microsoft.VisualStudio.Component.VC.Modules.x86.x64", "Microsoft.VisualStudio.Component.VC.Tools.ARM64", "Microsoft.VisualStudio.Component.VC.Tools.ARM64EC", diff --git a/images/win/windows2022.json b/images/win/windows2022.json index a427e239..703e4a1c 100644 --- a/images/win/windows2022.json +++ b/images/win/windows2022.json @@ -174,6 +174,7 @@ "type": "powershell", "scripts": [ "{{ template_dir }}/scripts/Installers/Install-Wix.ps1", + "{{ template_dir }}/scripts/Installers/Install-WDK.ps1", "{{ template_dir }}/scripts/Installers/Install-Vsix.ps1", "{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1", "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1",