|
5 | 5 | $toolName = 'WinDbg'
|
6 | 6 | $category = 'Debuggers'
|
7 | 7 |
|
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" |
10 | 10 |
|
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 |
18 | 25 | } 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 | + } |
20 | 35 | }
|
21 | 36 |
|
0 commit comments