Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor WinDbg install #1058

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions packages/windbg.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ try {
$toolName = 'WinDbg'
$category = 'Debuggers'

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

$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcut = Join-Path $shortcutDir "$toolName.lnk"
$executableCmd = Join-Path ${Env:WinDir} "system32\cmd.exe"
# Use `start` to close the open console
$executableArgs = "/C start WinDbgX.exe"
$executableDir = Join-Path ${Env:UserProfile} "Desktop"
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $executableDir -RunAsAdmin
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
url = $bundleUrl
checksum = $bundleSha256
checksumType = "sha256"
fileFullPath = Join-Path ${Env:TEMP} "$toolName.msixbundle"
}
Get-ChocolateyWebFile @packageArgs
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a VM-Assert-Path $packageArgs.fileFullPath to ensure the file has been downloaded before installing it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not necessary, as Get-ChocolateyWebFile will throw an error with "incorrect hash" if the file has not been downloaded.

Add-AppxPackage -Path $packageArgs.fileFullPath

$toolPackage = Get-AppxPackage -Name "Microsoft.$toolName"
$iconLocation = Join-Path $toolPackage.InstallLocation "DbgX.Shell.exe" -Resolve
$executablePath = "shell:AppsFolder\$($toolPackage.PackageFamilyName)!$($toolPackage.Name)"

VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath -iconLocation $iconLocation -RunAsAdmin
} catch {
VM-Write-Log-Exception $_
}

2 changes: 1 addition & 1 deletion packages/windbg.vm/windbg.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>windbg.vm</id>
<version>0.0.0</version>
<version>1.2402.24001.20250124</version>
<authors>Microsoft</authors>
<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>
<dependencies>
Expand Down
Loading