From b7be0a5fda2b4f183e60e3aa53a83bc55b3cc677 Mon Sep 17 00:00:00 2001 From: Valentin Klein Date: Sat, 10 Oct 2026 18:16:13 +0200 Subject: [PATCH] Windows installer: offer a desktop shortcut (#32) (#184) The MSI gets a setup wizard (WixUI dialogs, no licence or folder page) with a Shortcuts page: the Start Menu shortcut as before, plus an opt-in "Create a desktop shortcut" checkbox bound to DESKTOPSHORTCUT. Silent installs take DESKTOPSHORTCUT=1. The shortcut goes on the all-users desktop (per-machine install) in its own component with an HKCU key path (ICE38/43/57), so uninstall removes it; upgrades read that value back and keep the previous choice unless DESKTOPSHORTCUT is given. The build now needs WixToolset.UI.wixext 5.0.2 (release workflow and package.ps1 updated). Co-authored-by: Claude Opus 5.5 --- .github/workflows/release.yml | 4 +- README.md | 2 + docs/releasing.md | 1 + packaging/windows/cadcraft.wxs | 112 +++++++++++++++++++++++++++++++-- packaging/windows/package.ps1 | 6 +- 5 files changed, 118 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e33cba0..0ae1962 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -134,7 +134,9 @@ jobs: run: cargo xtask version set "$CADCRAFT_VERSION" - name: Install WiX shell: pwsh - run: dotnet tool install --global wix --version 5.0.2 + run: | + dotnet tool install --global wix --version 5.0.2 + wix extension add -g WixToolset.UI.wixext/5.0.2 - name: Build, sign, package shell: pwsh env: diff --git a/README.md b/README.md index 38f929a..fde99ec 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,8 @@ See [ROADMAP.md](ROADMAP.md) for milestones, measured parity and the estimate of Installers and executables are code-signed. +The installer adds CADCraft to the Start menu and asks whether to add a desktop shortcut too (unticked by default). For a silent install with the desktop shortcut: `msiexec /i cadcraft--windows-x64.msi /qn DESKTOPSHORTCUT=1`. + ### macOS | Build | File | Notes | diff --git a/docs/releasing.md b/docs/releasing.md index 1932726..29ecdff 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -6,5 +6,6 @@ The canonical recipe is craftrules' [`release/playbook.md`](https://github.com/s - **Cut a release:** bump the version on `main`, then push `main` to `release` (`git push origin main:release`). Every push to `release` runs `.github/workflows/release.yml` and creates or updates the draft GitHub Release `CADCraft v`. A `workflow_dispatch` run with `version: X.Y.Z-rc.N` makes a test build. A dispatch on any other branch is a dry run: the unsigned jobs (version, Linux, Flatpak, FreeBSD, web) build, the `release` environment refuses the signing jobs (macOS, Windows), and no release is drafted. - **Artifacts:** macOS universal `.dmg` (Developer ID signed, notarized, stapled) and CLI `.zip`; Windows x64, x86 and arm64 `.msi` + portable `.zip` (Azure Trusted Signing); Linux x86_64 and aarch64 `.AppImage` (+ `.AppImage.zsync` for AppImageUpdate delta updates), `.flatpak` bundle (repackages the tarball, `packaging/linux/flatpak-bundle.sh`), `.deb`, `.rpm`, `.tar.gz` (+ the from-source Flathub manifest in `packaging/linux/flatpak/`); FreeBSD x86_64 `.tar.gz` (built in a FreeBSD VM); web `.zip` (wasm + `index.html`, see `packaging/web/README.md`); `SHA256SUMS.txt`. - **Secrets:** the twelve signing secrets live in the `release` environment (deployable only from the `release` branch, which only org admins and release-managers can push). All are optional: a missing one produces unsigned artifacts with a warning. +- **Windows installer:** `packaging/windows/cadcraft.wxs` (WiX v5 + `WixToolset.UI.wixext`). Its wizard has a Shortcuts page: the Start Menu shortcut is always created, the desktop shortcut is opt-in (`DESKTOPSHORTCUT=1` for silent installs, `DESKTOPSHORTCUT=0` drops it on an upgrade; otherwise upgrades keep the previous choice). - **File types:** `.dxf` and `.dwg` (macOS document types, Windows "Open with", Linux MIME types). - **Local packaging test:** `packaging/macos/package.sh` (ad-hoc signed DMG), `packaging/linux/package.sh`, `packaging/web/package.sh`. diff --git a/packaging/windows/cadcraft.wxs b/packaging/windows/cadcraft.wxs index d40bc7c..50f82f6 100644 --- a/packaging/windows/cadcraft.wxs +++ b/packaging/windows/cadcraft.wxs @@ -1,11 +1,17 @@ + + + + + + + + + + + + + @@ -58,6 +82,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1 index fdd3d78..a6b8cf2 100644 --- a/packaging/windows/package.ps1 +++ b/packaging/windows/package.ps1 @@ -12,7 +12,9 @@ warning when no signing secrets are set). Needs: Rust (MSVC toolchain + the target), the Windows SDK (rc.exe, signtool.exe), - and WiX v5: dotnet tool install --global wix --version 5.0.2 + and WiX v5 with its UI extension (the setup wizard): + dotnet tool install --global wix --version 5.0.2 + wix extension add -g WixToolset.UI.wixext/5.0.2 .EXAMPLE pwsh packaging/windows/package.ps1 -Arch x64 @@ -93,7 +95,7 @@ Copy-Item (Join-Path $Bin 'cadcraft.exe'), (Join-Path $Bin 'cadcraft-cli.exe') $ # ---- MSI --------------------------------------------------------------------------------------- $Msi = Join-Path $Dist "cadcraft-$Version-windows-$Arch.msi" Invoke-Native 'wix build' { - wix build (Join-Path $PSScriptRoot 'cadcraft.wxs') -arch $Arch ` + wix build (Join-Path $PSScriptRoot 'cadcraft.wxs') -arch $Arch -ext WixToolset.UI.wixext ` -d "Version=$MsiVersion" -d "BinDir=$Stage" -d "IconPath=$(Join-Path $Root 'assets\app-icon\cadcraft.ico')" ` -o $Msi }