diff --git a/build.ps1 b/build.ps1 index e755473..958cf8d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -22,7 +22,7 @@ .PARAMETER toolset Specifies the Visual Studio toolset to use for the build. Valid options are: - "EWDK", "VS2022", "VS2019", "VS2017", "VS2015". Default is "EWDK". + "EWDK", "VS2026" "VS2022", "VS2019", "VS2017", "VS2015". Default is "EWDK". .PARAMETER projectPath The directory where the MSBuild project file to be built is located. Defaults to the current directory. @@ -106,7 +106,7 @@ param( [string] $htsToolsPath = $null, <# Which visual studio tools to use. - Specify one of "EWDK","VS2022","VS2019","VS2017","VS2015". + Specify one of "EWDK","VS2026","VS2022","VS2019","VS2017","VS2015". Default EWDK. #> [ValidateSet("EWDK","VS2026","VS2022","VS2019","VS2017","VS2015")] diff --git a/createCab.ps1 b/createCab.ps1 index 1951c78..c21cee1 100644 --- a/createCab.ps1 +++ b/createCab.ps1 @@ -1,3 +1,24 @@ +<# + +.SYNOPSIS + Creates a CAB file from a list of files. + +.DESCRIPTION + This script creates a CAB file using the makecab command. + +.PARAMETER name + The name of the CAB file to create. + +.PARAMETER path + The directory where the CAB file will be created. + +.PARAMETER files + An array of files to include in the CAB file. + +.PARAMETER keepFiles + A switch to keep the temporary files used in the CAB creation process. + +#> param( [string] $name, [string] $path, diff --git a/docs/build.md b/docs/build.md new file mode 100644 index 0000000..c44bc1f --- /dev/null +++ b/docs/build.md @@ -0,0 +1,353 @@ +# build + +Build a Visual Studio solution or project using the specified environment. + +## Syntax +```PowerShell +build.ps1 [[-jsonFile] ] [[-projectRootPath] ] [[-htsToolsPath] ] [[-toolset] ] [[-projectPath] ] [[-projectName] ] [[-target] ] [[-configurations] ] [[-platforms] ] [[-properties] ] [[-logDir] ] [[-consoleLogLevel] ] [[-buildNumber] ] [[-wrapper] ] [-detailedSummary] [-noNugetRestore] [-help] [] +``` +## Description + +This script automates the process of building Visual Studio solutions or projects. +It supports multiple Visual Studio versions, build configurations, and platforms. +The script can also read parameters from a JSON file. All build output is logged. + +## Examples + + +### Example 1 +```PowerShell +.\build.ps1 +Builds the project or solution located in the current directory using the default toolset (EWDK), +with the "Release" configuration and "x64" platform. +``` + + + + + + + + + + + + + +### Example 2 +```PowerShell +.\build.ps1 -toolset "VS2022" +Builds the project or solution located in the current directory using Visual Studio 2022, +with the "Release" configuration and "x64" platform. +``` + + + + + + + + + + + + + +### Example 3 +```PowerShell +.\build.ps1 -jsonFile "buildParams.json" +Builds the project using parameters specified in the "buildParams.json" file. +The json file format expected is a simple key-value pair structure. +The keys should match the parameter names of this script. +``` + + + + + + + + + + + + +## Paramaters + +### `-jsonFile` + + +Path to a JSON file containing parameter values. If provided, the script will +use the values from the JSON file to override default or explicitly set parameters. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | false | + + +### `-projectRootPath` + + +The root directory of the project. This is used to determine the location of +build tools and logs if not explicitly specified. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-htsToolsPath` + + +The path to the build tools directory. If not specified, it defaults to +"$projectRootPath/BuildTools". + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 3 | +| Required: | false | + + +### `-toolset` + + +Specifies the Visual Studio toolset to use for the build. Valid options are: +"EWDK", "VS2026" "VS2022", "VS2019", "VS2017", "VS2015". Default is "EWDK". + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | EWDK | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 4 | +| Required: | false | + + +### `-projectPath` + + +The directory where the MSBuild project file to be built is located. Defaults to the current directory. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | . | +| ParameterValue: | String | +| PipelineInput: | true (ByValue) | +| Position: | 5 | +| Required: | false | + + +### `-projectName` + + +The name of the MSBuild project file to be built. If not specified, the script +will attempt to find the first MSBuild-compatible project file in the projectPath. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 6 | +| Required: | false | + + +### `-target` + + +The build target to execute. Default is "Build". + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | Build | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 7 | +| Required: | false | + + +### `-configurations` + + +An array of build configurations to be built (e.g., "Release", "Debug"). +Default is "Release". Use "all" to build both "Release" and "Debug". + + +| | | +|---|---| +| Type: | String[] | +| DefaultValue: | Release | +| ParameterValue: | String[] | +| PipelineInput: | false | +| Position: | 8 | +| Required: | false | + + +### `-platforms` + + +An array of build platforms to be built (e.g., "x64", "x86"). Default is "x64". +Use "all" to build for all supported platforms. + + +| | | +|---|---| +| Type: | String[] | +| DefaultValue: | x64 | +| ParameterValue: | String[] | +| PipelineInput: | false | +| Position: | 9 | +| Required: | false | + + +### `-properties` + + +An array of arbitrary build properties in the format "name=value" to be passed to MSBuild. + + +| | | +|---|---| +| Type: | String[] | +| DefaultValue: | @() | +| ParameterValue: | String[] | +| PipelineInput: | false | +| Position: | 10 | +| Required: | false | + + +### `-logDir` + + +The directory path where build log files will be stored. If not specified, it defaults to +"$projectRootPath/logs" or "./logs" if projectRootPath is not set. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 11 | +| Required: | false | + + +### `-consoleLogLevel` + + +Specifies the verbosity of the console log output from MSBuild. Valid options are: +"Quiet", "Normal", "Verbose". Default is "Quiet". + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | Quiet | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 12 | +| Required: | false | + + +### `-buildNumber` + + +The build number for this build. This is passed as an MSBuild property named 'BuildNumber'. +Default is 0. + + +| | | +|---|---| +| Type: | Int32 | +| DefaultValue: | -1 | +| ParameterValue: | Int32 | +| PipelineInput: | false | +| Position: | 13 | +| Required: | false | + + +### `-wrapper` + + +A wrapper command or script to be used. The wrapper will be passed the MSBuild command line. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 14 | +| Required: | false | + + +### `-detailedSummary` + + +Switch to generate a detailed summary of the MSBuild process. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-noNugetRestore` + + +Switch to skip the NuGet package restore step. +If not specified, NuGet packages will be restored if a packages.config file is found in the projectPath. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-help` + + +Switch to display detailed help for this script. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/createCab.md b/docs/createCab.md new file mode 100644 index 0000000..ed29ab0 --- /dev/null +++ b/docs/createCab.md @@ -0,0 +1,75 @@ +# createCab + +Creates a CAB file from a list of files. + +## Syntax +```PowerShell +createCab.ps1 [[-name] ] [[-path] ] [[-files] ] [-keepFiles] [] +``` +## Description + +This script creates a CAB file using the makecab command. + +## Paramaters + +### `-name` + + +The name of the CAB file to create. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | false | + + +### `-path` + + +The directory where the CAB file will be created. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-files` + + +An array of files to include in the CAB file. + + +| | | +|---|---| +| Type: | String[] | +| ParameterValue: | String[] | +| PipelineInput: | false | +| Position: | 3 | +| Required: | false | + + +### `-keepFiles` + + +A switch to keep the temporary files used in the CAB creation process. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/driverProject.md b/docs/driverProject.md new file mode 100644 index 0000000..6f923a8 --- /dev/null +++ b/docs/driverProject.md @@ -0,0 +1,150 @@ +# driverProject + +Create a driver project from an existing +sample in a local copy of the github +repo https://github.com/microsoft/Windows-driver-samples. + +## Syntax +```PowerShell +driverProject.ps1 [-outputJson] [-projectRoot ] [-classGuid ] [-className ] [-providerString ] [-JsonFile ] [] + +driverProject.ps1 -sourcePath -targetPath -targetName [-projectRoot ] [-classGuid ] [-className ] [-providerString ] [-JsonFile ] [] +``` +## Paramaters + +### `-outputJson` + + +Outputs a json schema for the parameters to this script. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-sourcePath` + + +The path to the sample project to copy. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | true | + + +### `-targetPath` + + +The path to the directory where the new project will be created. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | true | + + +### `-targetName` + + +The name of the new project. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | true | + + +### `-projectRoot` + + +The root directory of the project. Defaults to the targetPath. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-classGuid` + + +The class guid for the driver. If not specified, the guid in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-className` + + +The class name for the driver. If not specified, the class name in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-providerString` + + +The provider string for the driver. If not specified, the provider string in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-JsonFile` + + +A json file containing the parameters for this script. If specified, the parameters in the json file will be used instead of the command line parameters. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/signobject.md b/docs/signobject.md new file mode 100644 index 0000000..f3d4bc5 --- /dev/null +++ b/docs/signobject.md @@ -0,0 +1,116 @@ +# signobject + +Signs a list of files using signtool.exe and a certificate specified in a json config file. + +## Syntax +```PowerShell +signobject.ps1 [[-files] ] [[-configFile] ] [-createJson] [-noisy] [] +``` +## Description + +This script signs a list of files using signtool.exe and a certificate specified in a json config file. +The json config file should contain the certificate thumbprint and a list of time servers to use for timestamping. + +## Examples + + +### Example 1 +```PowerShell +.\signobject.ps1 -files "file1.dll","file2.sys" -configFile "C:\path\to\signing.json" +Signs the specified files using the certificate and time servers specified in the signing.json file. +``` + + + + + + + + + + + + + +### Example 2 +```PowerShell +signobject.ps1 -createJson +Creates a sample json config file for signing. +``` + + + + + + + + + + + + +## Paramaters + +### `-files` + + +An array of files to sign. + + +| | | +|---|---| +| Type: | String[] | +| ParameterValue: | String[] | +| PipelineInput: | false | +| Position: | 1 | +| Required: | false | + + +### `-configFile` + + +The path to the json config file. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | "$($PSScriptRoot)\signing.json" | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-createJson` + + +Creates a sample json config file. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-noisy` + + +Displays the output of signtool.exe. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/updateProject.md b/docs/updateProject.md new file mode 100644 index 0000000..331cf62 --- /dev/null +++ b/docs/updateProject.md @@ -0,0 +1,123 @@ +# updateProject + +Add HTS extensions to msbuild project file + +## Syntax +```PowerShell +updateProject.ps1 [-projectFile] [[-classGuid] ] [[-className] ] [[-providerString] ] [[-targetName] ] [[-projectRoot] ] [-fixSampleInf] [] +``` +## Description + +This script adds the HTS extensions to an msbuild project file. +It adds the htsCommon.props and htsCommon.targets imports to the project file. +It also adds a PropertyGroup for ProjectRootPath and HtsToolsDir if they are not already defined in the project file. + +## Paramaters + +### `-projectFile` + + +The path to the msbuild project file to update. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | true | + + +### `-classGuid` + + +The class guid for the driver. If not specified, the guid in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-className` + + +The class name for the driver. If not specified, the class name in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 3 | +| Required: | false | + + +### `-providerString` + + +The provider string for the driver. If not specified, the provider string in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 4 | +| Required: | false | + + +### `-targetName` + + +The target name for the driver. If not specified, the target name in the sample inf file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 5 | +| Required: | false | + + +### `-projectRoot` + + +The root directory of the project. If not specified, the root directory of the project file will be used. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 6 | +| Required: | false | + + +### `-fixSampleInf` + + +If specified, the script will update the sample inf file with the class guid, +class name, provider string, and target name specified in the parameters. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/updatesyms.md b/docs/updatesyms.md new file mode 100644 index 0000000..236c2dc --- /dev/null +++ b/docs/updatesyms.md @@ -0,0 +1,140 @@ +# updatesyms + +Update symbol store with binary files + +## Syntax +```PowerShell +updatesyms.ps1 [-binaryPath] [[-configFile] ] [[-symstore] ] [[-comment] ] [[-version] ] [-createJson] [-WhatIf] [-v] [] +``` +## Description + +This script updates the symbol store with the specified binary files. + +## Paramaters + +### `-binaryPath` + + +The path to the binary files to add to the symbol store. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | true | + + +### `-configFile` + + +The path to the configuration file. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | .\sympath.json | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-symstore` + + +The path to the symstore executable. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 3 | +| Required: | false | + + +### `-comment` + + +A comment to add to the symbol store entry. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | local builds | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 4 | +| Required: | false | + + +### `-version` + + +The version of the binary files to add to the symbol store. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | (Get-Date).ToString("yyyy:MM:DD:HH:MM") | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 5 | +| Required: | false | + + +### `-createJson` + + +Creates a sample json config file. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-WhatIf` + + +Displays the command that would be executed without actually executing it. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + +### `-v` + + +Displays the output of symstore.exe. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/versionfiles.md b/docs/versionfiles.md new file mode 100644 index 0000000..cc8c431 --- /dev/null +++ b/docs/versionfiles.md @@ -0,0 +1,124 @@ +# versionfiles + +Generate version files for the project. + +## Syntax +```PowerShell +versionfiles.ps1 [[-verMajor] ] [[-verMinor] ] [[-verRev] ] [[-BuildNumber] ] [[-BuildString] ] [-incPath] [-generateProps] [] +``` +## Description + +This script generates the version files for the project, including the version.props and buildnumber.props files. + +## Paramaters + +### `-verMajor` + + +The major version number. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | 1 | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | false | + + +### `-verMinor` + + +The minor version number. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | 0 | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 2 | +| Required: | false | + + +### `-verRev` + + +The revision version number. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | 0 | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 3 | +| Required: | false | + + +### `-BuildNumber` + + +The build number. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | 0 | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 4 | +| Required: | false | + + +### `-BuildString` + + +The build string. Uses the current git sha for HEAD if not specified. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 5 | +| Required: | false | + + +### `-incPath` + + +The path to the include files where the version files will be generated. + + +| | | +|---|---| +| Type: | String | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 6 | +| Required: | true | + + +### `-generateProps` + + +Whether to generate the property files. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/docs/wdkEnv.md b/docs/wdkEnv.md new file mode 100644 index 0000000..fb95786 --- /dev/null +++ b/docs/wdkEnv.md @@ -0,0 +1,49 @@ +# wdkEnv + +Sets up the development environment for the Windows Driver Kit (WDK). + +## Syntax +```PowerShell +wdkEnv.ps1 [[-toolset] ] [-noSession] [] +``` +## Description + +This script sets up a powershell session for the development environment +for the Windows Driver Kit (WDK) by initializing the necessary environment variables and paths. +Supports the same set of toolsets as documented for build.ps1. +Does not support nuget based WDK/SDK builds. + +## Paramaters + +### `-toolset` + + +The toolset to use for the development environment. + + +| | | +|---|---| +| Type: | String | +| DefaultValue: | EWDK | +| ParameterValue: | String | +| PipelineInput: | false | +| Position: | 1 | +| Required: | false | + + +### `-noSession` + + +Specifies whether to create a new PowerShell session. + + +| | | +|---|---| +| Type: | SwitchParameter | +| DefaultValue: | False | +| ParameterValue: | SwitchParameter | +| PipelineInput: | false | +| Position: | named | +| Required: | false | + + diff --git a/driverProject.ps1 b/driverProject.ps1 index e8ffac4..d25fa5f 100644 --- a/driverProject.ps1 +++ b/driverProject.ps1 @@ -1,7 +1,28 @@ <# +.SYNOPSIS Create a driver project from an existing - sample in the github repo https://github.com/microsoft/Windows-driver-samples. - JSON SCHEMA + sample in a local copy of the github + repo https://github.com/microsoft/Windows-driver-samples. +.PARAMETER outputJson + Outputs a json schema for the parameters to this script. +.PARAMETER sourcePath + The path to the sample project to copy. +.PARAMETER targetPath + The path to the directory where the new project will be created. +.PARAMETER targetName + The name of the new project. +.PARAMETER projectRoot + The root directory of the project. Defaults to the targetPath. +.PARAMETER classGuid + The class guid for the driver. If not specified, the guid in the sample inf file will be used. +.PARAMETER className + The class name for the driver. If not specified, the class name in the sample inf file will be used. +.PARAMETER providerString + The provider string for the driver. If not specified, the provider string in the sample inf file will be used. +.PARAMETER JsonFile + A json file containing the parameters for this script. If specified, the parameters in the json file will be used instead of the command line parameters. +.NOTES + the JSON schema output file makes the parameters for this script clearer. #> [CmdletBinding()] param( diff --git a/readme.md b/readme.md index f155dc6..23d681a 100644 --- a/readme.md +++ b/readme.md @@ -1,153 +1,37 @@ -# NAME - build.ps1 -## SYNTAX -```powershell -build.ps1 [[-toolset] ] [[-projectPath] ] [[-projectName] ] [[-target] ] [[-configurations] ] [[-platforms] ] [[-properties] ] [[-logDir] ] [[-consoleLogLevel] ] [[-buildNumber] ] [[-wrapper] ] [-detailedSummary] [-help] [] -``` -## DESCRIPTION -Build a visual studio solution or project using the correct environment. -## PARAMETERS -### -toolset <String> -Which visual studio tools to use. -Specify one of "EWDK","VS2022","VS2019","VS2017","VS2015". -Default EWDK. -``` -Required? false -Position? 1 -Default value EWDK -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -projectPath <String> -the directory where the msbuild project file to be built is located -``` -Required? false -Position? 2 -Default value . -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -projectName <String> -the name of the msbuild project file to be built -``` -Required? false -Position? 3 -Default value -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -target <String> -the build target -``` -Required? false -Position? 4 -Default value Build -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -configurations <String[]> -an array of build configurations to be built. -``` -Required? false -Position? 5 -Default value Release -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -platforms <String[]> -an array of build platforms to be built -``` -Required? false -Position? 6 -Default value x64 -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -properties <String[]> -an array of arbitrary build property (name=value) strings that should be passed to the build -``` -Required? false -Position? 7 -Default value @() -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -logDir <String> -the directory path for build log files -``` -Required? false -Position? 8 -Default value .\logs -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -consoleLogLevel <String> -Verbosity of the console log from msbuild, one of "Quiet","Normal","Verbose". -Default: "Quiet". -``` -Required? false -Position? 9 -Default value Quiet -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -buildNumber <Int32> -the build number for this build, set as a msbuild property named 'buildNumber'. -``` -Required? false -Position? 10 -Default value 0 -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -wrapper <String> -a wrapper command or script, it will be passed the msbuild command line. -``` -Required? false -Position? 11 -Default value -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -detailedSummary <SwitchParameter> -generate an msbuild detailed summary -``` -Required? false -Position? named -Default value False -Accept pipeline input? false -Accept wildcard characters? false -``` - -### -help <SwitchParameter> -invoke help for this script. -``` -Required? false -Position? named -Default value False -Accept pipeline input? false -Accept wildcard characters? false -``` +# Build Tools -## INPUTS +## Powershell scripts and modules for building Visual Studio based msbuild C/C++ projects, focused on Windows driver projects. +### Basic Usage +1. Add this repo as a submodule to a visual studio driver project. +1. From powershell optionally add HTS extensions to the project .vxcproj file using [updateProject](docs/updateProject.md). +1. Use [build](docs/build.md) to build the project. -## OUTPUTS +# Scripts -## NOTES -Powershell 7 is assumed. These scripts may or may not work correctly with earlier versions of powershell. +## [build](docs/build.md) +Build a Visual Studio solution or project using the specified environment. +## [createCab](docs/createCab.md) +Creates a CAB file from a list of files. -## EXAMPLES +## [driverProject](docs/driverProject.md) +Create a driver project from an existing +sample in a local copy of the github +repo https://github.com/microsoft/Windows-driver-samples. + +## [signobject](docs/signobject.md) +Signs a list of files using signtool.exe and a certificate specified in a json config file. + +## [updateProject](docs/updateProject.md) +Add HTS extensions to msbuild project file + +## [updatesyms](docs/updatesyms.md) +Update symbol store with binary files + +## [versionfiles](docs/versionfiles.md) +Generate version files for the project. + +## [wdkEnv](docs/wdkEnv.md) +Sets up the development environment for the Windows Driver Kit (WDK). diff --git a/signobject.ps1 b/signobject.ps1 index e811cab..472407d 100644 --- a/signobject.ps1 +++ b/signobject.ps1 @@ -1,3 +1,25 @@ +<# +.SYNOPSIS + Signs a list of files using signtool.exe and a certificate specified in a json config file. +.DESCRIPTION + This script signs a list of files using signtool.exe and a certificate specified in a json config file. + The json config file should contain the certificate thumbprint and a list of time servers to use for timestamping. +.PARAMETER files +An array of files to sign. +.PARAMETER configFile +The path to the json config file. +.PARAMETER createJson +Creates a sample json config file. +.PARAMETER noisy +Displays the output of signtool.exe. + +.EXAMPLE + .\signobject.ps1 -files "file1.dll","file2.sys" -configFile "C:\path\to\signing.json" + Signs the specified files using the certificate and time servers specified in the signing.json file. +.EXAMPLE + signobject.ps1 -createJson + Creates a sample json config file for signing. +#> param ( [string[]] $files, [string] $configFile = "$($PSScriptRoot)\signing.json", @@ -7,7 +29,6 @@ param ( $ErrorActionPreference = 'Stop' $jsonSchema = @" -{ "certThumbPrint": "cert thumbprint", "timeservers": [ "ts-url1", diff --git a/updateProject.ps1 b/updateProject.ps1 index 20480cc..a1adf61 100644 --- a/updateProject.ps1 +++ b/updateProject.ps1 @@ -1,5 +1,26 @@ <# - Add HTS extensions to msbuild project file +.SYNOPSIS + Add HTS extensions to msbuild project file +.DESCRIPTION + This script adds the HTS extensions to an msbuild project file. + It adds the htsCommon.props and htsCommon.targets imports to the project file. + It also adds a PropertyGroup for ProjectRootPath and HtsToolsDir if they are not already defined in the project file. + +.PARAMETER projectFile + The path to the msbuild project file to update. +.PARAMETER classGuid + The class guid for the driver. If not specified, the guid in the sample inf file will be used. +.PARAMETER className + The class name for the driver. If not specified, the class name in the sample inf file will be used. +.PARAMETER providerString + The provider string for the driver. If not specified, the provider string in the sample inf file will be used. +.PARAMETER targetName + The target name for the driver. If not specified, the target name in the sample inf file will be used. +.PARAMETER projectRoot + The root directory of the project. If not specified, the root directory of the project file will be used. +.PARAMETER fixSampleInf + If specified, the script will update the sample inf file with the class guid, + class name, provider string, and target name specified in the parameters. #> param( [Parameter(Mandatory=$true)] diff --git a/updatesyms.ps1 b/updatesyms.ps1 index b5286ef..ee38184 100644 --- a/updatesyms.ps1 +++ b/updatesyms.ps1 @@ -1,3 +1,25 @@ +<# +.SYNOPSIS + Update symbol store with binary files +.DESCRIPTION + This script updates the symbol store with the specified binary files. +.PARAMETER binaryPath + The path to the binary files to add to the symbol store. +.PARAMETER configFile + The path to the configuration file. +.PARAMETER symstore + The path to the symstore executable. +.PARAMETER comment + A comment to add to the symbol store entry. +.PARAMETER version + The version of the binary files to add to the symbol store. +.PARAMETER createJson + Creates a sample json config file. +.PARAMETER WhatIf + Displays the command that would be executed without actually executing it. +.PARAMETER v + Displays the output of symstore.exe. +#> param( [Parameter(Mandatory= $true)] [string]$binaryPath, diff --git a/versionfiles.ps1 b/versionfiles.ps1 index f20add9..335c1f5 100644 --- a/versionfiles.ps1 +++ b/versionfiles.ps1 @@ -1,3 +1,23 @@ +<# +.SYNOPSIS + Generate version files for the project. +.DESCRIPTION + This script generates the version files for the project, including the version.props and buildnumber.props files. +.PARAMETER verMajor + The major version number. +.PARAMETER verMinor + The minor version number. +.PARAMETER verRev + The revision version number. +.PARAMETER BuildNumber + The build number. +.PARAMETER BuildString + The build string. Uses the current git sha for HEAD if not specified. +.PARAMETER incPath + The path to the include files where the version files will be generated. +.PARAMETER generateProps + Whether to generate the property files. +#> param( [string] $verMajor=1, [string] $verMinor=0, diff --git a/wdkEnv.ps1 b/wdkEnv.ps1 index 3b75d07..3e7537d 100644 --- a/wdkEnv.ps1 +++ b/wdkEnv.ps1 @@ -1,3 +1,19 @@ +<# +.SYNOPSIS + Sets up the development environment for the Windows Driver Kit (WDK). +.DESCRIPTION + This script sets up a powershell session for the development environment + for the Windows Driver Kit (WDK) by initializing the necessary environment variables and paths. + Supports the same set of toolsets as documented for build.ps1. + Does not support nuget based WDK/SDK builds. +.PARAMETER toolset + The toolset to use for the development environment. +.PARAMETER noSession + Specifies whether to create a new PowerShell session. +.NOTES + This script is intended to be used in a PowerShell environment. + +#> param( [ValidateSet("EWDK","VS2026","VS2022","VS2019","VS2017","VS2015")] [string]$toolset="EWDK",