Skip to content

Commit

Permalink
Switch to Get-VsSetupInstance in PowerShell Release Tool
Browse files Browse the repository at this point in the history
* Requires `Install-Module VSSetup -Scope CurrentUser` to be run before using the release tool.
* The latest version of Visual Studio 2022 removes the ability to find itself with WIM (the previous method)
  • Loading branch information
droidmonkey authored and phoerious committed Dec 13, 2023
1 parent cacf197 commit af0e779
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions release-tool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,19 @@ function Test-WorkingTreeClean {

function Invoke-VSToolchain([String] $Toolchain, [String] $Path, [String] $Arch) {
# Find Visual Studio installations
$vs = Get-CimInstance MSFT_VSInstance
$vs = Get-VSSetupInstance -All
if ($vs.count -eq 0) {
$err = "No Visual Studio installations found, download one from https://visualstudio.com/downloads."
$err = "$err`nIf Visual Studio is installed, you may need to repair the install then restart."
throw $err
}

$VSBaseDir = $vs[0].InstallLocation
$VSBaseDir = $vs[0].InstallationPath
if ($Toolchain) {
# Try to find the specified toolchain by name
foreach ($_ in $vs) {
if ($_.Name -eq $Toolchain) {
$VSBaseDir = $_.InstallLocation
if ($_.DisplayName -eq $Toolchain) {
$VSBaseDir = $_.InstallationPath
break
}
}
Expand All @@ -169,7 +169,7 @@ function Invoke-VSToolchain([String] $Toolchain, [String] $Path, [String] $Arch)
if ($i -lt 0 -or $i -ge $vs.count) {
throw "Invalid selection made"
}
$VSBaseDir = $vs[$i].InstallLocation
$VSBaseDir = $vs[$i].InstallationPath
}

# Bootstrap the specified VS Toolchain
Expand Down Expand Up @@ -429,8 +429,8 @@ if ($Merge) {
# SIG # Begin signature block
# MIIfXAYJKoZIhvcNAQcCoIIfTTCCH0kCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC3+AltPeI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7KT2kFhcDesDiQtw5s//8HsY4
# eY5DZgMPsCyy2zV6qrgiSYFcc/0uhAhPRm1nCuGjN1DwX2BrGt1UtlnmW01V3uqj
# wEe1okSoojcJbIhUWsuhJURQHLT/A3mmSOS5zi83+Dw0Qge1JOH3m3276FdSkDmJ
# ADI0usp59PPlbkQNcsM3cIfgr3e4rSn8tv4LOrbBUSM4MOPYfcHv/8qJPU0wgeA6
# 6coFGlo2FLNxqPc41QajxV+5XgRbQC4blcC3h/tdghJYHmOp1AHRCNy+I/nV56uU
# pDnfqfQ3FcxSthQU+d2GtmfDBs4MKVwc/DJmHTtTEsBF7T2m758QX/oap0P2Qbai
# x6mDbeeNh9w8DOcFqLciDg==
# SIG # End signature block

2 comments on commit af0e779

@ultralapse
Copy link
Contributor

@ultralapse ultralapse commented on af0e779 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@droidmonkey are you sure that using $vs = Get-CimInstance MSFT_VSInstance -Namespace root/cimv2/vs instead doesn't work? I don't think they removed the ability to find itself with WIM, it just that you have to explicitly specify the namespace. Made a PR here: #10101

@droidmonkey
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is 100% undocumented anywhere. Also if you dump the full WIMs class list, the VS one no longer is shown (although likely due to this namespace issue). In the future please write comments on the PR itself and not the commit.

Please sign in to comment.