Files
OrcaSlicer/scripts/msix/build_msix.ps1
SoftFever 15f330641c Add Microsoft Store MSIX package build (#14142)
* docs: add MSIX Store build design spec

* docs: update MSIX spec (PFN deep link, .drc, Associate tab) and add implementation plan

* ci: add MSIX logo asset generator and generated assets

* ci: fix MSIX asset rendering edge bleed (PixelOffsetMode) and make output order deterministic

* ci: add MSIX AppxManifest template

* ci: add MSIX packaging script

* ci: make build_msix.ps1 stage-only exit dot-source safe

* ci: build MSIX Store package in Windows job

* ci: run MSIX pack after existing Windows uploads and keep it out of release downloads

* feat: add MSIX packaged-context detection helpers

* fix: resolve MSIX package APIs dynamically to keep Win7 loadable

* feat: suppress self-update in MSIX Store build

* feat: suppress runtime file associations in MSIX Store build

* feat: keep version check in MSIX build, point update dialog at the Store

The update check is notification-only (OrcaSlicer never auto-downloads),
so the Store build keeps checking for new versions instead of skipping
the check. What changes when packaged is the new-version dialog: the
Download button is hidden, the info text asks the user to update from
the Microsoft Store, and the hyperlink / wxID_YES action opens the Store
product page instead of the GitHub release page.

* docs: align spec verification plan with Store-redirect updater behavior

* feat: default MSIX identity to the reserved Partner Center values

* feat: render MSIX logos full-bleed from the gradient-circle SVG

* feat: point update dialog Download button at the Store in MSIX builds

* feat: link Associate tab to Windows Default Apps settings in MSIX builds

* docs: align spec with review-driven logo, dialog and Associate-tab changes

* clearn up
2026-06-11 23:56:16 +08:00

68 lines
3.0 KiB
PowerShell

<#
Builds the unsigned MSIX Store package from an existing install tree.
The package is intentionally NOT signed: the Microsoft Store strips and
re-signs uploads with Microsoft's certificate. For local installs use
Developer Mode loose-layout registration instead:
./scripts/msix/build_msix.ps1 -StageOnly
Add-AppxPackage -Register <staging>\AppxManifest.xml
Requires the Windows SDK (makeappx.exe) unless -StageOnly is used.
#>
param(
[string]$InstallDir = "build/OrcaSlicer",
[string]$OutputPath = "build/OrcaSlicer_Windows_MSIX.msix",
[string]$StagingDir = "",
[switch]$StageOnly,
[string]$IdentityName = "OrcaSlicer.OrcaSlicer",
[string]$Publisher = "CN=38F7EA55-C73B-4072-B3B2-C8E0EA15BB82",
[string]$PublisherDisplayName = "OrcaSlicer"
)
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
# MSIX version = MAJOR.MINOR.PATCH.0 from the SoftFever_VERSION semver triplet
# (Store requires the revision field to be 0).
$versionContent = Get-Content (Join-Path $repoRoot 'version.inc') -Raw
if ($versionContent -notmatch 'set\(SoftFever_VERSION "(\d+)\.(\d+)\.(\d+)') {
throw "Could not parse SoftFever_VERSION from version.inc"
}
$msixVersion = "$($Matches[1]).$($Matches[2]).$($Matches[3]).0"
Write-Output "MSIX version: $msixVersion"
if (-not (Test-Path (Join-Path $InstallDir 'orca-slicer.exe'))) {
throw "orca-slicer.exe not found in '$InstallDir' - build the install tree first"
}
if ([string]::IsNullOrEmpty($StagingDir)) {
$StagingDir = Join-Path ([System.IO.Path]::GetTempPath()) 'orca-msix-staging'
}
if (Test-Path $StagingDir) { Remove-Item $StagingDir -Recurse -Force }
New-Item -ItemType Directory -Force $StagingDir | Out-Null
Copy-Item -Path (Join-Path $InstallDir '*') -Destination $StagingDir -Recurse
Copy-Item -Path (Join-Path $PSScriptRoot 'assets') -Destination (Join-Path $StagingDir 'Assets') -Recurse
$manifest = Get-Content (Join-Path $PSScriptRoot 'AppxManifest.xml') -Raw
$manifest = $manifest.Replace('@MSIX_VERSION@', $msixVersion)
$manifest = $manifest.Replace('@MSIX_IDENTITY_NAME@', $IdentityName)
$manifest = $manifest.Replace('@MSIX_PUBLISHER@', $Publisher)
$manifest = $manifest.Replace('@MSIX_PUBLISHER_DISPLAY_NAME@', $PublisherDisplayName)
Set-Content -Path (Join-Path $StagingDir 'AppxManifest.xml') -Value $manifest -Encoding utf8
if ($StageOnly) {
Write-Output "Staged loose layout at: $StagingDir"
return
}
$makeappx = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.*\x64\makeappx.exe" -ErrorAction SilentlyContinue |
Sort-Object { [version]$_.Directory.Parent.Name } -Descending |
Select-Object -First 1 -ExpandProperty FullName
if (-not $makeappx) {
throw "makeappx.exe not found under '${env:ProgramFiles(x86)}\Windows Kits\10\bin' - install the Windows SDK"
}
Write-Output "Using makeappx: $makeappx"
& $makeappx pack /d $StagingDir /p $OutputPath /o
if ($LASTEXITCODE -ne 0) { throw "makeappx pack failed with exit code $LASTEXITCODE" }
Write-Output "Packed: $OutputPath"