Sparse package icons need resources.pri at the external location
The shell resolves Square44x44Logo through the package resource index; this package never had a resources.pri, so every icon lookup failed and Start/taskbar showed a generic icon regardless of the Assets PNGs. Empirically (SHLoadIndirectString against the live package), with AllowExternalContent MRT loads resources from the EXTERNAL location, not the manifest's folder — so Register-vRIO.ps1 now copies Assets\ and resources.pri next to the exe before registering. Make-Assets.ps1 regenerates the PNGs from vwe.ico and rebuilds the pri (needs makepri from the Windows SDK / SDK.BuildTools NuGet). Package version bumped; the MrtCache is keyed by package full name, so same-version re-registration serves stale lookups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,10 +16,13 @@
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap uap3 uap10 rescap">
|
||||
|
||||
<!-- Bump Version on any Assets/resources.pri change: the shell's MrtCache
|
||||
is keyed by package full name and serves stale (even failed) icon
|
||||
lookups for a re-registered same-version package. -->
|
||||
<Identity Name="VWE.vRIO"
|
||||
ProcessorArchitecture="neutral"
|
||||
Publisher="CN=VWE"
|
||||
Version="1.0.0.0" />
|
||||
Version="1.0.0.1" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>vRIO</DisplayName>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Regenerates pkg\Assets\*.png from src\VRio.App\vwe.ico and rebuilds
|
||||
resources.pri — run after changing the icon artwork.
|
||||
|
||||
The shell resolves the manifest's Square44x44Logo through the package
|
||||
resource index; without resources.pri every icon lookup fails and the
|
||||
Start menu / taskbar show a generic icon. After regenerating, bump the
|
||||
Version in AppxManifest.xml (the shell's MrtCache is keyed by package
|
||||
full name and serves stale lookups otherwise) and re-register with
|
||||
Register-vRIO.ps1.
|
||||
|
||||
.PARAMETER MakePri
|
||||
Path to makepri.exe. Auto-detected from the Windows SDK if installed;
|
||||
otherwise extract it from the Microsoft.Windows.SDK.BuildTools NuGet
|
||||
package (it is a zip: bin\<ver>\x64\makepri.exe).
|
||||
#>
|
||||
param([string]$MakePri)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
if (-not $MakePri) {
|
||||
$MakePri = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin' -Recurse -Filter makepri.exe -ErrorAction SilentlyContinue |
|
||||
Where-Object FullName -like '*\x64\*' | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $MakePri) {
|
||||
throw 'makepri.exe not found — install the Windows SDK or pass -MakePri (see help).'
|
||||
}
|
||||
}
|
||||
|
||||
$assets = Join-Path $PSScriptRoot 'Assets'
|
||||
$ico = New-Object System.Drawing.Icon((Join-Path $PSScriptRoot '..\src\VRio.App\vwe.ico'), 32, 32)
|
||||
$src = $ico.ToBitmap()
|
||||
|
||||
function Save-Png([int]$canvas, [int]$content, [string]$name) {
|
||||
$bmp = New-Object System.Drawing.Bitmap($canvas, $canvas)
|
||||
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
||||
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$off = [int](($canvas - $content) / 2)
|
||||
$g.DrawImage($src, $off, $off, $content, $content)
|
||||
$g.Dispose()
|
||||
$bmp.Save((Join-Path $assets $name), [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$bmp.Dispose()
|
||||
Write-Host " $name"
|
||||
}
|
||||
|
||||
Save-Png 44 44 'logo44.png'
|
||||
Save-Png 150 96 'logo150.png' # medium tile: 3x upscale centered, crisper than full-bleed
|
||||
foreach ($ts in 16, 24, 32, 48) {
|
||||
# targetsize / altform-unplated variants are found by naming convention;
|
||||
# unplated is what the Win11 taskbar prefers.
|
||||
Save-Png $ts $ts "logo44.targetsize-$ts.png"
|
||||
Save-Png $ts $ts "logo44.targetsize-${ts}_altform-unplated.png"
|
||||
}
|
||||
$src.Dispose(); $ico.Dispose()
|
||||
|
||||
$cf = Join-Path $env:TEMP 'vrio-priconfig.xml'
|
||||
& $MakePri createconfig /cf $cf /dq en-US /o | Out-Null
|
||||
& $MakePri new /pr $PSScriptRoot /cf $cf /mn (Join-Path $PSScriptRoot 'AppxManifest.xml') /of (Join-Path $PSScriptRoot 'resources.pri') /o | Out-Null
|
||||
Remove-Item $cf
|
||||
Write-Host 'resources.pri rebuilt. Now bump Version in AppxManifest.xml and re-register.'
|
||||
@@ -39,6 +39,13 @@ $exe = Join-Path $ExePath 'VRio.App.exe'
|
||||
if (-not (Test-Path $exe)) { throw "VRio.App.exe not found in '$ExePath'" }
|
||||
$manifest = Join-Path $PSScriptRoot 'AppxManifest.xml'
|
||||
|
||||
# With AllowExternalContent the shell resolves the manifest's logo assets
|
||||
# against the EXTERNAL location, not the manifest's folder — the Start/taskbar
|
||||
# icon only shows if Assets\ and resources.pri sit next to the exe.
|
||||
$assetDir = New-Item -ItemType Directory -Force (Join-Path $ExePath 'Assets')
|
||||
Copy-Item (Join-Path $PSScriptRoot 'Assets\*') $assetDir -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot 'resources.pri') $ExePath -Force
|
||||
|
||||
Add-AppxPackage -Register $manifest -ExternalLocation (Resolve-Path $ExePath).Path
|
||||
$family = (Get-AppxPackage -Name $packageName).PackageFamilyName
|
||||
Write-Host "Registered $packageName with external location '$ExePath'."
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user