cad-editor/packaging/windows/main.wxs
Claude e24447a70d
feat(installer): register Open CAD Studio as a default-app candidate for .dwg/.dxf
Adds a DefaultPrograms component publishing Capabilities and a
RegisteredApplications entry under HKLM. This makes Open CAD Studio
appear in Settings > Default Apps and the shell "Open with" list, so
users can set it as the default handler for .dwg and .dxf files.

Modern Windows guards the actual default behind a per-user UserChoice
hash that an installer cannot forge, so this is the supported path to
becoming the default rather than silently overwriting the association.

https://claude.ai/code/session_01DFVSKgViFaxEjZD2KsTdtt
2026-06-12 07:30:49 +00:00

177 lines
6.8 KiB
XML

<?xml version='1.0' encoding='windows-1252'?>
<!--
WiX source for the Windows MSI installer.
Build (CI / locally with WiX Toolset 3.x in PATH):
candle.exe -arch x64 -dVersion=<x.y.z> -dSource=target\release\OpenCADStudio.exe \
-dIcon=packaging\windows\AppIcon.ico packaging\windows\main.wxs \
-out packaging\windows\main.wixobj
light.exe packaging\windows\main.wixobj -ext WixUIExtension -out OpenCADStudio.msi
Provides:
* Per-machine install under Program Files\Open CAD Studio.
* Start Menu shortcut under Programs\Open CAD Studio.
* File associations for .dwg and .dxf via a single ProgID; both
route through `OpenCADStudio.exe "%1"` so the OS hands the file
path to the app as argv[1] (consumed in OpenCADStudio::boot).
* Default Programs registration (Capabilities + RegisteredApplications)
so the app shows up in Settings > Default Apps and can be set as the
default handler for .dwg / .dxf.
* Standard Add/Remove Programs entry with icon.
* MajorUpgrade — installing a newer MSI replaces the old version.
-->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Id='*'
Name='Open CAD Studio'
UpgradeCode='bd6bceab-6c7a-4ce2-a62d-6ef06a92f8b1'
Manufacturer='Hakan Seven'
Language='1033'
Codepage='1252'
Version='$(var.Version)'>
<Package
Id='*'
Keywords='Installer'
Description='Open CAD Studio Installer'
Manufacturer='Hakan Seven'
InstallerVersion='450'
Languages='1033'
Compressed='yes'
InstallScope='perMachine'
SummaryCodepage='1252' />
<MajorUpgrade
Schedule='afterInstallInitialize'
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.' />
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<Icon Id='AppIcon.ico' SourceFile='$(var.Icon)' />
<Property Id='ARPPRODUCTICON' Value='AppIcon.ico' />
<Property Id='ARPHELPLINK' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Property Id='ARPURLINFOABOUT' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFiles64Folder'>
<Directory Id='APPLICATIONROOTDIRECTORY' Name='Open CAD Studio'>
<Component Id='MainExecutable' Guid='2900c116-e9a5-4650-8a4c-48c0987d1a33' Win64='yes'>
<File
Id='OpenCADStudioEXE'
Name='OpenCADStudio.exe'
DiskId='1'
Source='$(var.Source)'
KeyPath='yes'>
<Shortcut
Id='StartMenuShortcut'
Directory='ProgramMenuDir'
Name='Open CAD Studio'
Description='Launch Open CAD Studio'
WorkingDirectory='APPLICATIONROOTDIRECTORY'
Icon='AppIcon.ico'
IconIndex='0'
Advertise='yes' />
</File>
<!--
File associations. Two ProgIDs (one per extension) so the
`<Verb Id='open'>` rows don't collide on the same registry
primary key — both ProgIDs invoke the same exe with the
file path as `argv[1]`.
-->
<ProgId
Id='OpenCADStudio.DWG'
Description='DWG Drawing'
Icon='OpenCADStudioEXE'
IconIndex='0'>
<Extension Id='dwg' ContentType='image/vnd.dwg'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
<ProgId
Id='OpenCADStudio.DXF'
Description='DXF Drawing'
Icon='OpenCADStudioEXE'
IconIndex='0'>
<Extension Id='dxf' ContentType='image/vnd.dxf'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
</Component>
<!--
Default Programs registration. The ProgId/Extension rows above
register the handlers, but modern Windows (8+) guards the actual
default via a per-user UserChoice hash an installer can't forge.
Publishing Capabilities + a RegisteredApplications entry is the
supported way in: it makes Open CAD Studio appear in Settings >
Default Apps and the "Open with" list, so .dwg / .dxf can be set
to it. The keys are HKLM-wide, so the shell picks them up on its
next association query without a forced refresh.
-->
<Component Id='DefaultPrograms' Guid='6f3e9b2a-1c4d-4f8a-9b7e-2d5a8c1f0e63' Win64='yes'>
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationName'
Type='string'
Value='Open CAD Studio'
KeyPath='yes' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationDescription'
Type='string'
Value='2D/3D CAD application for DWG and DXF drawings.' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dwg'
Type='string'
Value='OpenCADStudio.DWG' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dxf'
Type='string'
Value='OpenCADStudio.DXF' />
<RegistryValue
Root='HKLM'
Key='Software\RegisteredApplications'
Name='Open CAD Studio'
Type='string'
Value='Software\Open CAD Studio\Capabilities' />
</Component>
</Directory>
</Directory>
<Directory Id='ProgramMenuFolder'>
<Directory Id='ProgramMenuDir' Name='Open CAD Studio'>
<Component Id='ProgramMenuDirComp' Guid='34a788ba-f9d4-4e73-b1ff-9eb8749b369e'>
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue
Root='HKCU'
Key='Software\Open CAD Studio'
Name='installed'
Type='integer'
Value='1'
KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Title='Open CAD Studio' Level='1'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='DefaultPrograms' />
<ComponentRef Id='ProgramMenuDirComp' />
</Feature>
<!-- Installer UI + finish-screen launch checkbox (see ui.wxs). -->
<UIRef Id='OpenCADStudioUI' />
</Product>
</Wix>