Two widget pages share one process (Game Bar + a window). After CrossSound restarted, both reconnected to /events at once; with System.Net.Http on UWP the HTTP cache made the second GET wait for the first to finish, which an event stream never does, and the request had no timeout. - Move to Windows.Web.Http with the cache off and 16 connections per server - Unique query per stream request; headers must arrive within 8 s or retry - Timeouts on commands (10 s) and library calls (30 s) - Connection log in LocalState\widget.log - Skip SoundCloud's "Recently played" shelf (repeats the history) - deploy.ps1: close the widget first, update the layout in place, and re-register a dev-mode package of the same version Co-Authored-By: Claude Opus 5.5 <[email protected]>
51 lines
3.1 KiB
PowerShell
51 lines
3.1 KiB
PowerShell
# Build the widget and register it for the current user (Developer Mode), the same way Visual Studio's
|
|
# Deploy does. Run from any folder: powershell -ExecutionPolicy Bypass -File .\deploy.ps1 [-Configuration Release]
|
|
param(
|
|
[ValidateSet('Debug', 'Release')] [string] $Configuration = 'Debug',
|
|
[ValidateSet('x64', 'x86')] [string] $Platform = 'x64'
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = $PSScriptRoot
|
|
|
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
$vs = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath | Select-Object -First 1
|
|
$msbuild = Join-Path $vs 'MSBuild\Current\Bin\MSBuild.exe'
|
|
|
|
& $msbuild "$root\CrossSoundWidget.sln" -restore "-p:Configuration=$Configuration" "-p:Platform=$Platform" -v:minimal -nologo -m
|
|
if ($LASTEXITCODE -ne 0) { throw "Build failed ($LASTEXITCODE)" }
|
|
|
|
$version = ([xml](Get-Content "$root\Package.appxmanifest")).Package.Identity.Version
|
|
$packageDir = "$root\AppPackages\CrossSoundWidget_${version}_${Platform}_${Configuration}_Test"
|
|
$msix = Get-ChildItem $packageDir -Filter *.msix | Select-Object -First 1
|
|
|
|
# Framework packages the build ships next to the msix (.NET Core runtime, VCLibs). Already-installed ones are skipped.
|
|
Get-ChildItem "$packageDir\Dependencies\$Platform" -File -ErrorAction SilentlyContinue | ForEach-Object {
|
|
try { Add-AppxPackage $_.FullName -ErrorAction Stop } catch { }
|
|
}
|
|
|
|
# Register an unpacked layout so rebuilds replace it in place (no certificate install needed).
|
|
# The running widget holds the layout's files open, so close it first.
|
|
$layout = "$root\bin\$Platform\$Configuration\Layout"
|
|
Get-Process CrossSoundWidget -ErrorAction SilentlyContinue | Stop-Process -Force
|
|
Start-Sleep -Milliseconds 500
|
|
# Unpack to a staging folder, then mirror it into the layout. The layout folder itself must stay:
|
|
# Windows only re-registers the same version from the same, still-existing folder.
|
|
$staging = "$root\bin\$Platform\$Configuration\LayoutStaging"
|
|
if (Test-Path $staging) { Remove-Item -Recurse -Force $staging }
|
|
$zip = "$root\bin\$Platform\$Configuration\package.zip"
|
|
Copy-Item $msix.FullName $zip -Force
|
|
Expand-Archive $zip $staging
|
|
Remove-Item $zip
|
|
Remove-Item "$staging\AppxSignature.p7x", "$staging\AppxBlockMap.xml", "$staging\[Content_Types].xml", "$staging\AppxMetadata" -Recurse -Force -ErrorAction SilentlyContinue
|
|
robocopy $staging $layout /MIR /NFL /NDL /NJH /NJS /NP | Out-Null
|
|
if ($LASTEXITCODE -ge 8) { throw "Copying the layout failed (robocopy $LASTEXITCODE)" }
|
|
Remove-Item -Recurse -Force $staging
|
|
|
|
# Windows won't re-register a dev-mode package at the same version, so remove it first. Its data
|
|
# (LocalState, the log) is kept; the loopback exemption is tied to the family name and survives.
|
|
$existing = Get-AppxPackage RedLintu16.CrossSoundWidget
|
|
if ($existing -and $existing.IsDevelopmentMode) { Remove-AppxPackage $existing.PackageFullName -PreserveApplicationData }
|
|
Add-AppxPackage -Register "$layout\AppxManifest.xml" -ForceApplicationShutdown
|
|
Get-AppxPackage RedLintu16.CrossSoundWidget | Select-Object PackageFamilyName, Version
|
|
Write-Host 'Deployed. Open Game Bar (Win+G) > Widgets > CrossSound.'
|