Skip to content

Commit aa25833

Browse files
committed
Refactor WinDbg install
1 parent 5aae1f0 commit aa25833

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

packages/windbg.vm/tools/chocolateyinstall.ps1

+25-10
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,32 @@ try {
55
$toolName = 'WinDbg'
66
$category = 'Debuggers'
77

8-
# It seems WinDbg is now distributed as an .appinstaller and we need to install it using Add-AppxPackage
9-
Add-AppxPackage -AppInstallerFile 'https://windbg.download.prss.microsoft.com/dbazure/prod/1-0-0/windbg.appinstaller'
8+
$bundleUrl = "https://windbg.download.prss.microsoft.com/dbazure/prod/1-2402-24001-0/windbg.msixbundle"
9+
$bundleSha256 = "e941076cb4d7912d32a22ea87ad2693c01fa465227b4d1ead588283518de428f"
1010

11-
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
12-
$shortcut = Join-Path $shortcutDir "$toolName.lnk"
13-
$executableCmd = Join-Path ${Env:WinDir} "system32\cmd.exe"
14-
# Use `start` to close the open console
15-
$executableArgs = "/C start WinDbgX.exe"
16-
$executableDir = Join-Path ${Env:UserProfile} "Desktop"
17-
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $executableDir -RunAsAdmin
11+
$packageArgs = @{
12+
packageName = ${Env:ChocolateyPackageName}
13+
url = $bundleUrl
14+
checksum = $bundleSha256
15+
checksumType = "sha256"
16+
fileFullPath = Join-Path ${Env:TEMP} "$toolName.msixbundle"
17+
}
18+
Get-ChocolateyWebFile @packageArgs
19+
Add-AppxPackage -Path $packageArgs.fileFullPath
20+
21+
$installDir = (Get-AppxPackage -Name "Microsoft.$toolName").InstallLocation
22+
$iconLocation = Join-Path $installDir "DbgX.Shell.exe" -Resolve
23+
$executablePath = "$(where.exe WinDbgXA.exe)"
24+
VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath -iconLocation $iconLocation -RunAsAdmin
1825
} catch {
19-
VM-Write-Log-Exception $_
26+
if ($_.Exception.Message -match "INFO: Could not find files for the given pattern\(s\).")
27+
{
28+
$executablePath = Join-Path $installDir "DbgX.Shell.exe"
29+
VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath -iconLocation $iconLocation -RunAsAdmin
30+
}
31+
else
32+
{
33+
VM-Write-Log-Exception $_
34+
}
2035
}
2136

packages/windbg.vm/windbg.vm.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
33
<metadata>
44
<id>windbg.vm</id>
5-
<version>0.0.0</version>
5+
<version>1.2402.24001.20240527</version>
66
<authors>Microsoft</authors>
77
<description>WinDbg is a debugger that can be used to analyze crash dumps, debug live user-mode and kernel-mode code, and examine CPU registers and memory.</description>
88
<dependencies>

0 commit comments

Comments
 (0)