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 <noreply@anthropic.com>
This commit is contained in:
Valentin Klein 2026-10-10 18:16:13 +02:00 committed by GitHub
parent 14cffbcbe6
commit b7be0a5fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 118 additions and 7 deletions

View File

@ -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:

View File

@ -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-<ver>-windows-x64.msi /qn DESKTOPSHORTCUT=1`.
### macOS
| Build | File | Notes |

View File

@ -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<version>`. 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`.

View File

@ -1,11 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
CADCraft MSI (WiX Toolset v5: `dotnet tool install -g wix`). Built by package.ps1:
CADCraft MSI (WiX Toolset v5: `dotnet tool install -g wix`, plus the WixUI extension:
`wix extension add -g WixToolset.UI.wixext/5.0.2`). Built by package.ps1:
wix build cadcraft.wxs -arch x64 -d Version=1.2.3 -d BinDir=... -d IconPath=... -o out.msi
wix build cadcraft.wxs -arch x64 -ext WixToolset.UI.wixext -d Version=1.2.3 -d BinDir=... -d IconPath=... -o out.msi
Per-machine install into Program Files, a Start Menu shortcut, and CADCraft offered under
"Open with" for .dxf and .dwg drawings (without taking over the user's default app).
Per-machine install into Program Files, a Start Menu shortcut, an optional desktop shortcut, and
CADCraft offered under "Open with" for .dxf and .dwg drawings (without taking over the user's
default app).
Desktop shortcut: the setup wizard asks (unchecked by default). Silent installs leave it out
unless asked: `msiexec /i cadcraft.msi /qn DESKTOPSHORTCUT=1`. Upgrades keep the previous choice
unless DESKTOPSHORTCUT=1 or DESKTOPSHORTCUT=0 is given.
-->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package
@ -33,6 +39,24 @@
<Directory Id="INSTALLFOLDER" Name="CADCraft" />
</StandardDirectory>
<StandardDirectory Id="ProgramMenuFolder" />
<!-- Per-machine (ALLUSERS=1), so this is the all-users (Public) desktop, like the Start Menu above. -->
<StandardDirectory Id="DesktopFolder" />
<!-- "Create a desktop shortcut": the wizard's checkbox sets it to 1 (cleared = unset), and
silent installs pass DESKTOPSHORTCUT=1. Secure, so the elevated install sees the UI choice. -->
<Property Id="DESKTOPSHORTCUT" Secure="yes" />
<!-- The previous install's choice (the shortcut component's HKCU key path, so the installing
user's), so upgrades keep the desktop shortcut without asking again. -->
<Property Id="PREVIOUSDESKTOPSHORTCUT">
<RegistrySearch Id="PreviousDesktopShortcut" Root="HKCU" Key="Software\Learning Machines LLC\CADCraft"
Name="DesktopShortcut" Type="raw" />
</Property>
<!-- Only when DESKTOPSHORTCUT wasn't given; "first" runs it once (in the UI sequence when there
is one), so unticking the box isn't undone by the execute sequence. -->
<SetProperty Id="DESKTOPSHORTCUT" Value="1" After="AppSearch" Sequence="first"
Condition="NOT DESKTOPSHORTCUT AND PREVIOUSDESKTOPSHORTCUT = &quot;1&quot;" />
<UIRef Id="CadcraftUI" />
<Feature Id="Main" Title="CADCraft" Level="1">
<ComponentGroupRef Id="CadcraftFiles" />
@ -58,6 +82,86 @@
<Component Id="CadcraftCli">
<File Id="CadcraftCliExe" Source="$(var.BinDir)\cadcraft-cli.exe" KeyPath="yes" />
</Component>
<!-- Optional desktop shortcut, removed on uninstall. A non-advertised shortcut needs a registry
key path, and one in a profile folder (DesktopFolder, even though ALLUSERS=1 makes it the
Public desktop) must be under HKCU (ICE38, ICE43, ICE57). -->
<Component Id="DesktopShortcut" Directory="DesktopFolder" Guid="76029CD7-EBDB-420F-AC34-FF0E82A99E32"
Condition="DESKTOPSHORTCUT = &quot;1&quot;">
<Shortcut Id="DesktopShortcut" Name="CADCraft" Description="CADCraft computer-aided design"
Target="[INSTALLFOLDER]cadcraft.exe" WorkingDirectory="INSTALLFOLDER" Icon="CadcraftIcon.ico" IconIndex="0" />
<RegistryValue Root="HKCU" Key="Software\Learning Machines LLC\CADCraft" Name="DesktopShortcut"
Value="1" Type="string" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
<!--
Setup wizard: WixUI_InstallDir's flow (WiX v5, ext/UI/wixlib/WixUI_InstallDir.wxs) without the
licence and folder pages, plus a Shortcuts page:
install: Welcome > Shortcuts > Ready to install > Progress > Finish
maintenance: Maintenance welcome > Repair/Remove > Ready > Progress > Finish
-->
<Fragment>
<UI Id="CadcraftUI">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Dialog Id="ShortcutsDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg" />
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes"
Text="Choose where to start [ProductName] from." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes"
Text="{\WixUI_Font_Title}Shortcuts" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="StartMenuText" Type="Text" X="20" Y="60" Width="330" Height="15" NoPrefix="yes"
Text="[ProductName] will be added to the Start menu." />
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="85" Width="330" Height="17"
Property="DESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a &amp;desktop shortcut" />
</Dialog>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="ShortcutsDlg" Condition="NOT Installed" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />
<Publish Dialog="ShortcutsDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
<Publish Dialog="ShortcutsDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ShortcutsDlg" Order="1" Condition="NOT Installed" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed AND NOT PATCH" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed AND PATCH" />
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg" />
<!-- No "Change" in Apps & features: there is a single feature. -->
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>

View File

@ -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
}