From d651c8859c8917135c6d664517550e0f898905f7 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:55:50 -0700 Subject: [PATCH 01/12] Deprecate WDK vsix install --- .github/scripts/Install-Vsix.ps1 | 2 +- .github/workflows/Code-Scanning.yml | 3 --- .github/workflows/ci-pr.yml | 3 --- .github/workflows/ci.yml | 3 --- Build-SampleSet.ps1 | 22 +++++++++------------- Building-Locally.md | 2 +- configuration.dsc.yaml | 19 ++----------------- configuration_vsonly.dsc.yaml | 3 ++- 8 files changed, 15 insertions(+), 42 deletions(-) diff --git a/.github/scripts/Install-Vsix.ps1 b/.github/scripts/Install-Vsix.ps1 index 50ef088b0..3ca8c65d5 100644 --- a/.github/scripts/Install-Vsix.ps1 +++ b/.github/scripts/Install-Vsix.ps1 @@ -1,7 +1,7 @@ <# .SYNOPSIS -Download and install the latest WDK VSIX. +DEPRECATED #> diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml index cd0d8abfd..313ce215c 100644 --- a/.github/workflows/Code-Scanning.yml +++ b/.github/workflows/Code-Scanning.yml @@ -37,9 +37,6 @@ jobs: with: submodules: 'recursive' - - name: Install WDK VSIX - run: .\.github\scripts\Install-Vsix.ps1 - - name: Install Nuget Packages run: nuget restore .\packages.config -PackagesDirectory .\packages\ diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index c04f4adb8..72fb176f3 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -22,9 +22,6 @@ jobs: with: submodules: 'recursive' - - name: Install WDK VSIX - run: .\.github\scripts\Install-Vsix.ps1 - - name: Install Nuget Packages run: nuget restore .\packages.config -PackagesDirectory .\packages\ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c35a81ec1..11dee203e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,6 @@ jobs: with: submodules: 'recursive' - - name: Install WDK VSIX - run: .\.github\scripts\Install-Vsix.ps1 - - name: Install Nuget Packages run: nuget restore .\packages.config -PackagesDirectory .\packages\ diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index adae8bb06..8c48bd181 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -61,7 +61,6 @@ finally { $build_environment="" $build_number=0 $nuget_package_version=0 -$vsix_version="" # # In Github we build using NuGet and get the version from packages and vsix version from env var set from the install vsix step. # @@ -69,7 +68,6 @@ if ($env:GITHUB_REPOSITORY) { $build_environment="GitHub" $nuget_package_version=([regex]'(?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches((Get-Childitem .\packages\*WDK.x64* -Name)).Value $build_number=$nuget_package_version.split('.')[2] - $vsix_version = $env:SAMPLES_VSIX_VERSION } # # WDK NuGet will require presence of a folder 'packages'. The version is sourced from repo .\Env-Vars.ps1. @@ -107,16 +105,14 @@ else { exit 1 } # -# Get the vsix version from packages if not set -if (-not $vsix_version) { - $vsix_version = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name - if ($vsix_version) { - $vsix_version = $vsix_version.split('=')[1] - } - else { - Write-Error "No version of the WDK VSIX could be found. The WDK VSIX is not installed." - exit 1 - } +# Get the WDK extension version from installed packages +$wdk_extension_ver = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name +if ($wdk_extension_ver) { + $wdk_extension_ver = $wdk_extension_ver.split('=')[1] +} +else { + Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed." + exit 1 } # # @@ -183,7 +179,7 @@ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count Write-Output ("Build Environment: " + $build_environment) Write-Output ("Build Number: " + $build_number) if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { Write-Output ("Nuget Package Version: " + $nuget_package_version) } -Write-Output ("WDK VSIX Version: " + $vsix_version) +Write-Output ("WDK Visual Studio Extension Version: " + $wdk_extension_ver) Write-Output ("Samples: " + $sampleSet.Count) Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") diff --git a/Building-Locally.md b/Building-Locally.md index e3db8dde7..add5c91c9 100644 --- a/Building-Locally.md +++ b/Building-Locally.md @@ -92,7 +92,7 @@ To build the Windows Driver Samples you need a "driver build environment". In e >nuget restore -PackagesDirectory .\packages ``` -* When this is done you should have a .\packages folder that looks exactly as follows: +* When this is done you should have a .\packages folder that looks like example below: ``` >cd path\to\your\repos\Windows-driver-samples >dir /b packages diff --git a/configuration.dsc.yaml b/configuration.dsc.yaml index f8245c080..3d25ff064 100644 --- a/configuration.dsc.yaml +++ b/configuration.dsc.yaml @@ -42,6 +42,7 @@ properties: - Microsoft.VisualStudio.Component.VC.MFC.ARM64 - Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre - Microsoft.VisualStudio.Workload.NativeDesktop + - Component.Microsoft.Windows.DriverKit - resource: Microsoft.WinGet.DSC/WinGetPackage id: sdkPackage directives: @@ -62,20 +63,4 @@ properties: id: Microsoft.WindowsWDK.10.0.26100 source: winget useLatest: true - - resource: PSDscResources/Script - id: wdkVsix - dependsOn: - - wdkPackage - - vsComponents - directives: - description: Install Windows Driver Kit VSIX - settings: - GetScript: | - return & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -version '[17.0,18.0)' -requires Microsoft.Windows.DriverKit -property installationVersion - SetScript: | - $installerPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -latest -products * -property enginePath | Join-Path -ChildPath 'VSIXInstaller.exe' - if (Test-Path $installerPath) { & $installerPath /q "${env:ProgramFiles(x86)}\Windows Kits\10\Vsix\VS2022\10.0.26100.0\${env:PROCESSOR_ARCHITECTURE}\WDK.vsix" } - TestScript: | - $versionString = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -version '[17.0,18.0)' -requires Microsoft.Windows.DriverKit -property installationVersion - return $versionString -match "^17\." - configurationVersion: 0.2.0 + configurationVersion: 0.2.1 diff --git a/configuration_vsonly.dsc.yaml b/configuration_vsonly.dsc.yaml index 6ce4fc83c..9d86a4f74 100644 --- a/configuration_vsonly.dsc.yaml +++ b/configuration_vsonly.dsc.yaml @@ -42,4 +42,5 @@ properties: - Microsoft.VisualStudio.Component.VC.MFC.ARM64 - Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre - Microsoft.VisualStudio.Workload.NativeDesktop - configurationVersion: 0.2.0 + - Component.Microsoft.Windows.DriverKit + configurationVersion: 0.2.1 From 671fe6d54e99d26e51cb0fbebea627c09032199f Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:13:03 -0700 Subject: [PATCH 02/12] Fix WDK extension version print --- Build-SampleSet.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 8c48bd181..dd3fd4f14 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -107,6 +107,7 @@ else { # # Get the WDK extension version from installed packages $wdk_extension_ver = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name +$wdk_extension_ver = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($wdk_extension_ver).Value if ($wdk_extension_ver) { $wdk_extension_ver = $wdk_extension_ver.split('=')[1] } @@ -178,8 +179,10 @@ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count Write-Output ("Build Environment: " + $build_environment) Write-Output ("Build Number: " + $build_number) -if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { Write-Output ("Nuget Package Version: " + $nuget_package_version) } -Write-Output ("WDK Visual Studio Extension Version: " + $wdk_extension_ver) +if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { +Write-Output ("Nuget Package Version: " + $nuget_package_version) +} +Write-Output ("WDK Extension Version: " + $wdk_extension_ver) Write-Output ("Samples: " + $sampleSet.Count) Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") From b7ff72994477e11277b244cd2e5c5f95a3d9dae4 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:18:41 -0700 Subject: [PATCH 03/12] Remove unecessary splitting on version --- Build-SampleSet.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index dd3fd4f14..b60a86955 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -108,10 +108,7 @@ else { # Get the WDK extension version from installed packages $wdk_extension_ver = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name $wdk_extension_ver = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($wdk_extension_ver).Value -if ($wdk_extension_ver) { - $wdk_extension_ver = $wdk_extension_ver.split('=')[1] -} -else { +if (-not $wdk_extension_ver) { Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed." exit 1 } From 1cd93a661d30a2f19744bee0f63a61ff8c50592f Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:28:41 -0700 Subject: [PATCH 04/12] Minor build info refactor --- Build-SampleSet.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index b60a86955..a90c2bc0f 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -174,22 +174,22 @@ $jresult = @{ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count -Write-Output ("Build Environment: " + $build_environment) -Write-Output ("Build Number: " + $build_number) +Write-Output "WDK Build Environment: $build_environment" +Write-Output "WDK Build Number: $build_number" if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { -Write-Output ("Nuget Package Version: " + $nuget_package_version) +Write-Output "WDK Nuget Version: $nuget_package_version" } -Write-Output ("WDK Extension Version: " + $wdk_extension_ver) -Write-Output ("Samples: " + $sampleSet.Count) -Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") -Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") +Write-Output "WDK Extension Version: $wdk_extension_ver" +Write-Output ("Samples: " + $sampleSet.Count) +Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") +Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") Write-Output "InfVerif_AdditionalOptions: $InfVerif_AdditionalOptions" Write-Output "Combinations: $SolutionsTotal" Write-Output "LogicalProcessors: $LogicalProcessors" Write-Output "ThrottleFactor: $ThrottleFactor" Write-Output "ThrottleLimit: $ThrottleLimit" Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs" -Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB))) +Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB))) Write-Output "" Write-Output "T: Combinations" Write-Output "B: Built" From 7d962bfa12b38055671cb29c041ca1a1aeeeb634 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:42:46 -0700 Subject: [PATCH 05/12] Fix indentation of output info --- Build-SampleSet.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index a90c2bc0f..5c99d4ac8 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -180,16 +180,16 @@ if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { Write-Output "WDK Nuget Version: $nuget_package_version" } Write-Output "WDK Extension Version: $wdk_extension_ver" -Write-Output ("Samples: " + $sampleSet.Count) -Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") -Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") +Write-Output "Samples: $($sampleSet.Count)" +Write-Output "Configurations: $($Configurations.Count) ($Configurations)" +Write-Output "Platforms: $($Platforms.Count) ($Platforms)" Write-Output "InfVerif_AdditionalOptions: $InfVerif_AdditionalOptions" Write-Output "Combinations: $SolutionsTotal" Write-Output "LogicalProcessors: $LogicalProcessors" Write-Output "ThrottleFactor: $ThrottleFactor" Write-Output "ThrottleLimit: $ThrottleLimit" Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs" -Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB))) +Write-Output "Disk Remaining (GB): $(((Get-Volume ((Get-Item ".").PSDrive.Name)) | Select -ExpandProperty SizeRemaining) / 1GB)" Write-Output "" Write-Output "T: Combinations" Write-Output "B: Built" From 6cb4ba923863732e1475bf23a618882d4b9f8c05 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:55:48 -0700 Subject: [PATCH 06/12] Enough messing with volume size output --- Build-SampleSet.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 5c99d4ac8..b92464fe3 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -189,7 +189,7 @@ Write-Output "LogicalProcessors: $LogicalProcessors" Write-Output "ThrottleFactor: $ThrottleFactor" Write-Output "ThrottleLimit: $ThrottleLimit" Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs" -Write-Output "Disk Remaining (GB): $(((Get-Volume ((Get-Item ".").PSDrive.Name)) | Select -ExpandProperty SizeRemaining) / 1GB)" +Write-Output "Disk Remaining (GB): $(((Get-Volume ((Get-Item ".").PSDrive.Name)).SizeRemaining) / 1GB)" Write-Output "" Write-Output "T: Combinations" Write-Output "B: Built" From 4ecd3e8315f5db70e36f708688556c790acb7dba Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:44:40 -0700 Subject: [PATCH 07/12] Cleanup comment for vsix version --- Build-SampleSet.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index b92464fe3..46fc7dc6e 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -56,7 +56,6 @@ finally { # Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'. # Determine build number (used for exclusions based on build number). Five digits. Say, '22621'. # Determine NuGet package version (if applicable). -# Determine WDK vsix version. # $build_environment="" $build_number=0 From d69790e988073c3c7da139b3b19c68dda2d58e8d Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:42:57 -0700 Subject: [PATCH 08/12] More cleanup and doc update --- Build-SampleSet.ps1 | 2 +- Building-Locally.md | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 46fc7dc6e..f6765395a 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -61,7 +61,7 @@ $build_environment="" $build_number=0 $nuget_package_version=0 # -# In Github we build using NuGet and get the version from packages and vsix version from env var set from the install vsix step. +# In Github we build using NuGet. # if ($env:GITHUB_REPOSITORY) { $build_environment="GitHub" diff --git a/Building-Locally.md b/Building-Locally.md index add5c91c9..cbc44bc85 100644 --- a/Building-Locally.md +++ b/Building-Locally.md @@ -34,6 +34,7 @@ When: This step is only required to build sample usb\usbview . Easy: If you will install Visual Studio (see later) you may at that point select to add both of following individual components: * .NET Framework 4.7.2 targeting pack * .NET Framework 4.8.1 SDK +* Windows Driver Kit ### Option B: Use EWDK Easy: If you use EWDK, then all necessary prequisites are included. @@ -79,11 +80,17 @@ To build the Windows Driver Samples you need a "driver build environment". In e ### Option A: Use WDK NuGet Packages * See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete "Step 1". You do not need to install the SDK or the WDK. -* Install the Visual Studio Windows Driver Kit Extension (WDK.vsix). - * Open Visual Studio -> Extensions -> Manage Extensions... -> Browse. - * In the search bar type: `Windows Driver Kit`. - * Find the `Microsoft` signed extension. - * Click the Install button. + +> Deprecated +>* Install the Visual Studio Windows Driver Kit Extension (WDK.vsix). +> * Open Visual Studio -> Extensions -> Manage Extensions... -> Browse. +> * In the search bar type: `Windows Driver Kit`. +> * Find the `Microsoft` signed extension. +> * Click the Install button. + +Visual Studio now includes the Windows Driver Kit as an individual component. See [Option A](./Building-Locally.md#option-a-install-vs-components) from above. + +* Ensure Windows Driver Kit individual component is installed. See [Install Visual Studio 2022](https://learn.microsoft.com/en-us/windows-hardware/drivers/install-the-wdk-using-nuget#install-visual-studio-2022). * Launch a "Developer Command Prompt for VS 2022". * Restore WDK packages from feed : From e5fa023a671620b760fe4fec0bd6b69c8cfdb62f Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:56:46 -0700 Subject: [PATCH 09/12] Remove deprecation statement and install vsix script. --- .github/scripts/Install-Vsix.ps1 | 38 -------------------------------- Building-Locally.md | 9 +------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 .github/scripts/Install-Vsix.ps1 diff --git a/.github/scripts/Install-Vsix.ps1 b/.github/scripts/Install-Vsix.ps1 deleted file mode 100644 index 3ca8c65d5..000000000 --- a/.github/scripts/Install-Vsix.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -<# - -.SYNOPSIS -DEPRECATED - -#> - -# set uri by resolving amd64 vsix -$uri = "https://marketplace.visualstudio.com$((Invoke-WebRequest -Uri "https://marketplace.visualstudio.com/items?itemName=DriverDeveloperKits-WDK.WDKVsix").Links | Where-Object outerHTML -like '*(amd64)*' | select -expand href)" - -# set download version -$uri_version = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($uri).Value - -# set msbuild path -$msbuild_path = (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\MSBuild\") - -# download vsix, expand, and store the downloaded version extracted from the extension manifest -"Downloading WDK VSIX version: $uri_version..." -Invoke-WebRequest -Uri "$uri" -OutFile wdk.zip -"Expanding WDK VSIX archive..." -Expand-Archive ".\wdk.zip" .\ -"Extracting version from manifest..." -$downloaded_version = ([xml](Get-Content .\extension.vsixmanifest)).PackageManifest.Metadata.Identity.Version -"Downloaded WDK VSIX version: $downloaded_version" - -# copy msbuild files, extension manifest, and check installed version from the extension manifest -"Copying WDK extension files to build path..." -cp (".\`$MSBuild\*", ".\extension.vsixmanifest") "$msbuild_path" -Recurse -Force -"Extracting version from copied manifest..." -$installed_version = ([xml](Get-Content ${msbuild_path}\extension.vsixmanifest)).PackageManifest.Metadata.Identity.Version -"Installed WDK VSIX Version: $installed_version" -if (-not ("$downloaded_version" -eq "$installed_version")) { - "WDK VSIX installation failed due to version mismatch" - exit 1 -} - -# set github environment variable for vsix version -"SAMPLES_VSIX_VERSION=$installed_version" | Out-File -FilePath "$env:GITHUB_ENV" -Append diff --git a/Building-Locally.md b/Building-Locally.md index cbc44bc85..9f6f0c617 100644 --- a/Building-Locally.md +++ b/Building-Locally.md @@ -79,14 +79,7 @@ To build the Windows Driver Samples you need a "driver build environment". In e * The Windows Driver Kit. ### Option A: Use WDK NuGet Packages -* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete "Step 1". You do not need to install the SDK or the WDK. - -> Deprecated ->* Install the Visual Studio Windows Driver Kit Extension (WDK.vsix). -> * Open Visual Studio -> Extensions -> Manage Extensions... -> Browse. -> * In the search bar type: `Windows Driver Kit`. -> * Find the `Microsoft` signed extension. -> * Click the Install button. +* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete `Step 1`. You do not need to install the SDK or the WDK. Visual Studio now includes the Windows Driver Kit as an individual component. See [Option A](./Building-Locally.md#option-a-install-vs-components) from above. From 446a92f8d91d4d074805d7b68b311013939a59f0 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:24:44 -0700 Subject: [PATCH 10/12] Fixes and updates to building locally documentation. --- Building-Locally.md | 66 ++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/Building-Locally.md b/Building-Locally.md index 9f6f0c617..312c59674 100644 --- a/Building-Locally.md +++ b/Building-Locally.md @@ -2,16 +2,19 @@ ## Step 1: Install Tools -``` +```powershell winget install --id Microsoft.Powershell --source winget winget install --id Git.Git --source winget ``` For using WDK NuGet feed based build additionally: -``` + +```powershell winget install --id Microsoft.NuGet --source winget ``` +--- + ## Step 2: Optional: Disable Strong Name Validation When: This step is only required if you will be using pre-release versions of the WDK. @@ -26,17 +29,20 @@ reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,31bf3856 reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,31bf3856ad364e35 /v TestPublicKey /t REG_SZ /d 00240000048000009400000006020000002400005253413100040000010001003f8c902c8fe7ac83af7401b14c1bd103973b26dfafb2b77eda478a2539b979b56ce47f36336741b4ec52bbc51fecd51ba23810cec47070f3e29a2261a2d1d08e4b2b4b457beaa91460055f78cc89f21cd028377af0cc5e6c04699b6856a1e49d5fad3ef16d3c3d6010f40df0a7d6cc2ee11744b5cfb42e0f19a52b8a29dc31b0 /f ``` +--- + ## Step 3: Optional: Install Microsoft .NET Framework 4.7.2 Targeting Pack and Microsoft .NET Framework 4.8.1 SDK When: This step is only required to build sample usb\usbview . ### Option A: Install VS Components + Easy: If you will install Visual Studio (see later) you may at that point select to add both of following individual components: * .NET Framework 4.7.2 targeting pack * .NET Framework 4.8.1 SDK -* Windows Driver Kit ### Option B: Use EWDK + Easy: If you use EWDK, then all necessary prequisites are included. ### Option C: Install Developer Pack @@ -53,24 +59,30 @@ This will install following Apps: * Microsoft .NET Framework 4.8.1 Targeting Pack * Microsoft .NET Framework 4.8.1 Targeting Pack (ENU) +--- + ## Step 4: Clone Windows Driver Samples and checkout relevant branch -``` -cd path\to\your\repos -git clone --recurse-submodules https://github.com/microsoft/Windows-driver-samples.git -cd Windows-driver-samples +```powershell +cd "path\to\your\repos" +git clone --recurse-submodules "https://github.com/microsoft/Windows-driver-samples.git" +cd ".\Windows-driver-samples" ``` If you are planning to use in-market WDK, then you would typically want to use the 'main' branch: + ``` git checkout main ``` If you are planning to use a WDK Preview or WDK EEAP release, then you would typically want to use the 'develop' branch: + ``` git checkout develop ``` +--- + ## Step 5: Create a "driver build environment" To build the Windows Driver Samples you need a "driver build environment". In essence an environment that consist of following prerequisites: @@ -79,52 +91,55 @@ To build the Windows Driver Samples you need a "driver build environment". In e * The Windows Driver Kit. ### Option A: Use WDK NuGet Packages -* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete `Step 1`. You do not need to install the SDK or the WDK. - -Visual Studio now includes the Windows Driver Kit as an individual component. See [Option A](./Building-Locally.md#option-a-install-vs-components) from above. -* Ensure Windows Driver Kit individual component is installed. See [Install Visual Studio 2022](https://learn.microsoft.com/en-us/windows-hardware/drivers/install-the-wdk-using-nuget#install-visual-studio-2022). +* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete `Step 1`. You do not need to install the SDK or the WDK. * Launch a "Developer Command Prompt for VS 2022". * Restore WDK packages from feed : -``` ->cd path\to\your\repos\Windows-driver-samples ->nuget restore -PackagesDirectory .\packages +```powershell +cd "path\to\your\repos\Windows-driver-samples" +nuget restore -PackagesDirectory ".\packages" ``` * When this is done you should have a .\packages folder that looks like example below: -``` ->cd path\to\your\repos\Windows-driver-samples ->dir /b packages + +```powershell +cd "path\to\your\repos\Windows-driver-samples" +dir /b packages Microsoft.Windows.SDK.CPP.10.0.26000.1 Microsoft.Windows.SDK.CPP.x64.10.0.26000.1 Microsoft.Windows.SDK.CPP.arm64.10.0.26000.1 Microsoft.Windows.WDK.x64.10.0.26000.1 Microsoft.Windows.WDK.arm64.10.0.26000.1 ``` + ### Option B: Use the Windows Driver Kit + * Here you will install each of above prerequisites one at a time. * See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, SDK, and WDK. * Launch a "Developer Command Prompt for VS 2022". ### Option C: Use an Enterprise WDK + * You can also simply use the Enterprise WDK (EWDK), a standalone, self-contained command-line environment for building drivers that contains all prerequisites in one combined ISO. * See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to download the EWDK. * Mount ISO image * Open a terminal * `.\LaunchBuildEnv` +--- ## Step 6: Check all samples builds with expected results for all flavors -``` +```powershell pwsh .\Build-AllSamples ``` Above builds all samples for all configurations and platforms. You can refine what exact samples to build, what configurations, and platforms to build. build Here are a few examples: -``` + +```powershell # Get Help: Get-Help .\Build-AllSamples @@ -144,9 +159,9 @@ Get-Help .\Build-AllSamples .\Build-AllSamples -Samples '^tools.' -Configurations 'Debug' -Platforms 'x64' ``` -Expected output: +Example of expected output: + ``` -PS > .\build-AllSamples.ps1 Build Environment: NuGet Build Number: 26100 Samples: 132 @@ -190,6 +205,8 @@ Log files directory: .\_logs Overview report: .\_overview.htm ``` +--- + ## 7: NuGet - Additional Notes To restore a specific version of our WDK NuGet packages: @@ -201,12 +218,13 @@ Follow these steps before running "nuget restore" command: * Now you can run "nuget restore" A few examples of how to interact with nuget: -``` + +```powershell # To add an alternative online NuGet source: -nuget sources add -Name "MyNuGetFeed" -Source https://nugetserver.com/_packaging/feedname/nuget/v3/index.json +nuget sources add -Name "MyNuGetFeed" -Source "https://nugetserver.com/_packaging/feedname/nuget/v3/index.json" # To add an alternative local NuGet source: -nuget sources add -Name "MyNuGetFeed" -Source \\path\to\mylocalrepo +nuget sources add -Name "MyNuGetFeed" -Source "\\path\to\mylocalrepo" # To remove an alternative NuGet source: nuget sources remove -Name "MyNuGetFeed" From c296156372aadcdf3a4a63d0cb9e7b4dd8ce0828 Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:26:47 -0700 Subject: [PATCH 11/12] Dont code scan on license or .md files. --- .github/workflows/Code-Scanning.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml index 313ce215c..a24bd561f 100644 --- a/.github/workflows/Code-Scanning.yml +++ b/.github/workflows/Code-Scanning.yml @@ -8,6 +8,9 @@ on: branches: - main - develop + paths-ignore: + - '**.md' + - 'LICENSE' pull_request: # The branches below must be a subset of the branches above branches: From 1ae2176ed0ebffe280fb58c9f46add7aa8e8e0be Mon Sep 17 00:00:00 2001 From: Matt <138825652+middlemose@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:24:20 -0700 Subject: [PATCH 12/12] Code scanning ignore changes to .md when pull request is made --- .github/workflows/Code-Scanning.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml index a24bd561f..16aaff39c 100644 --- a/.github/workflows/Code-Scanning.yml +++ b/.github/workflows/Code-Scanning.yml @@ -16,6 +16,9 @@ on: branches: - main - develop + paths-ignore: + - '**.md' + - 'LICENSE' # Allow manual scheduling workflow_dispatch: