Skip to content

Commit 9853bc9

Browse files
authored
Update formatting scripts for Preview-only VS and pwsh 7 (#20312)
This is a pair of changes to make the code formatting scripts work, circa 2026. * If you only have VS Insiders installed, then vswhere can't actually find a clang-format to build with. You need `-prerelease` to let it also find preview builds of VS. * Years ago we updated OpenConsole.psm1 to only support pwsh 7. I, of course, use `cmd` as my dev env for terminal, so I use `runformat.cmd`, which always shelled to `powershell` (5). This updates that tool to use pwsh 7. Clearly this impacted only me ever. related to #20162
1 parent 2c9d152 commit 9853bc9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tools/OpenConsole.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ function Invoke-CodeFormat() {
416416
[switch]$IgnoreXaml
417417
)
418418

419-
$clangFormatPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -find "**\x64\bin\clang-format.exe"
419+
$clangFormatPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -prerelease -find "**\x64\bin\clang-format.exe"
420420
If ([String]::IsNullOrEmpty($clangFormatPath)) {
421421
Write-Error "No Visual Studio-supplied version of clang-format could be found."
422422
}

tools/runformat.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
rem run clang-format on c++ files
44

5-
powershell -noprofile "import-module %OPENCON_TOOLS%\openconsole.psm1; Invoke-CodeFormat"
5+
pwsh -noprofile -c "import-module %OPENCON_TOOLS%\openconsole.psm1; Invoke-CodeFormat"

0 commit comments

Comments
 (0)