mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-08 11:13:15 +02:00
96b8e4b19c
WiX v7 requires conditions to be set via the Condition attribute, not as inner text of the Custom element.
160 lines
7.5 KiB
XML
160 lines
7.5 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
QElectroTech.wxs - WiX v7 installer definition
|
|
Generates a self-contained x64 MSI for QElectroTech (MSYS2/UCRT64 build).
|
|
|
|
Variables passed from the wix build command line:
|
|
-d FilesDir=<absolute path to artifact\files>
|
|
-d Version=<numeric version e.g. 0.100.1.0>
|
|
-d ProductVersion=<display version e.g. 0.100.1-r8770-abc1234_x86_64-win64>
|
|
-d LicenseRtf=<absolute path to License.rtf>
|
|
-->
|
|
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
|
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
|
|
|
|
<Package
|
|
Name="QElectroTech"
|
|
Manufacturer="QElectroTech Team"
|
|
Version="$(var.Version)"
|
|
UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
|
|
Language="1033"
|
|
Codepage="1252"
|
|
InstallerVersion="500"
|
|
Scope="perMachine">
|
|
|
|
<!-- Embed all cabinet files inside the MSI (self-contained installer) -->
|
|
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
|
|
|
|
<!-- In-place upgrade: automatically uninstalls the previous version -->
|
|
<MajorUpgrade
|
|
DowngradeErrorMessage="A newer version of QElectroTech is already installed."
|
|
Schedule="afterInstallInitialize" />
|
|
|
|
<!-- Installation directory -->
|
|
<StandardDirectory Id="ProgramFiles64Folder">
|
|
<Directory Id="INSTALLDIR" Name="QElectroTech" />
|
|
</StandardDirectory>
|
|
|
|
<!-- ============================================================
|
|
All application files harvested in one pass from files\**
|
|
(Lancer QET.bat has been removed from the artifact before
|
|
this build — see windows-msi.yml step "Remove Lancer QET.bat")
|
|
============================================================ -->
|
|
<ComponentGroup Id="CG_AllFiles" Directory="INSTALLDIR">
|
|
<Files Include="$(var.FilesDir)\**" />
|
|
</ComponentGroup>
|
|
|
|
<!-- ============================================================
|
|
Desktop + Start Menu shortcuts
|
|
Point directly to qelectrotech.exe with all required arguments.
|
|
No .bat wrapper needed.
|
|
============================================================ -->
|
|
<ComponentGroup Id="CG_Shortcuts" Directory="INSTALLDIR">
|
|
|
|
<Component Id="C_ShortcutDesktop" Guid="F1A2B3C4-D5E6-7890-5678-012345678901">
|
|
<Shortcut Id="DesktopShortcut"
|
|
Directory="DesktopFolder"
|
|
Name="QElectroTech"
|
|
Target="[INSTALLDIR]bin\qelectrotech.exe"
|
|
Arguments="--common-elements-dir="[INSTALLDIR]elements/" --common-tbt-dir="[INSTALLDIR]titleblocks/" --lang-dir="[INSTALLDIR]lang/" -style windowsvista"
|
|
Icon="qet.ico"
|
|
WorkingDirectory="INSTALLDIR" />
|
|
<RegistryValue Root="HKCU"
|
|
Key="Software\QElectroTech"
|
|
Name="DesktopShortcut"
|
|
Type="integer" Value="1"
|
|
KeyPath="yes" />
|
|
</Component>
|
|
|
|
<Component Id="C_ShortcutStartMenu" Guid="A2B3C4D5-E6F7-8901-6789-123456789012">
|
|
<Shortcut Id="StartMenuShortcut"
|
|
Directory="ProgramMenuFolder"
|
|
Name="QElectroTech"
|
|
Target="[INSTALLDIR]bin\qelectrotech.exe"
|
|
Arguments="--common-elements-dir="[INSTALLDIR]elements/" --common-tbt-dir="[INSTALLDIR]titleblocks/" --lang-dir="[INSTALLDIR]lang/" -style windowsvista"
|
|
Icon="qet.ico"
|
|
WorkingDirectory="INSTALLDIR" />
|
|
<RegistryValue Root="HKCU"
|
|
Key="Software\QElectroTech"
|
|
Name="StartMenuShortcut"
|
|
Type="integer" Value="1"
|
|
KeyPath="yes" />
|
|
</Component>
|
|
|
|
</ComponentGroup>
|
|
|
|
<!-- ============================================================
|
|
.qet file association
|
|
============================================================ -->
|
|
<ComponentGroup Id="CG_FileAssoc" Directory="INSTALLDIR">
|
|
<Component Id="C_FileAssoc" Guid="B3C4D5E6-F7A8-9012-7890-234567890123">
|
|
<RegistryValue Root="HKCR" Key=".qet" Type="string" Value="QElectroTech.Document" KeyPath="yes" />
|
|
<RegistryValue Root="HKCR" Key="QElectroTech.Document" Type="string" Value="QElectroTech Project" />
|
|
<RegistryValue Root="HKCR" Key="QElectroTech.Document\DefaultIcon" Type="string"
|
|
Value="[INSTALLDIR]ico\qelectrotech.ico" />
|
|
<RegistryValue Root="HKCR" Key="QElectroTech.Document\shell\open\command" Type="string"
|
|
Value=""[INSTALLDIR]bin\qelectrotech.exe" "%1"" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
|
|
<!-- ============================================================
|
|
Icon for shortcuts
|
|
============================================================ -->
|
|
<Icon Id="qet.ico" SourceFile="$(var.FilesDir)\ico\qelectrotech.ico" />
|
|
|
|
<!-- ============================================================
|
|
CustomAction: set elements\ subtree read-only after install
|
|
|
|
Pattern used: two-step SetProperty + Exec
|
|
1. CA_ResolveElementsPath (immediate, SetProperty):
|
|
copies the runtime value of INSTALLDIR into the property
|
|
ELEMENTS_READONLY_CMD, building the full powershell command.
|
|
2. CA_SetElementsReadOnly (deferred, Execute="deferred"):
|
|
runs the command stored in ELEMENTS_READONLY_CMD.
|
|
|
|
This is the correct WiX v4/v7 pattern for passing a
|
|
directory path (resolved at runtime) to a deferred CA.
|
|
============================================================ -->
|
|
|
|
<!-- Step 1: build the powershell command with the resolved INSTALLDIR -->
|
|
<CustomAction Id="CA_ResolveElementsPath"
|
|
Property="CA_SetElementsReadOnly"
|
|
Value="powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -Command "Get-ChildItem -LiteralPath '[INSTALLDIR]elements' -Recurse -File | ForEach-Object { `$_.IsReadOnly = `$true }"" />
|
|
|
|
<!-- Step 2: deferred execution of the powershell command -->
|
|
<CustomAction Id="CA_SetElementsReadOnly"
|
|
BinaryRef="Wix4UtilCA_X86"
|
|
DllEntry="WixQuietExec"
|
|
Execute="deferred"
|
|
Impersonate="no"
|
|
Return="ignore" />
|
|
|
|
<InstallExecuteSequence>
|
|
<Custom Action="CA_ResolveElementsPath" After="InstallFiles" Condition="NOT Installed AND NOT REMOVE" />
|
|
<Custom Action="CA_SetElementsReadOnly" After="CA_ResolveElementsPath" Condition="NOT Installed AND NOT REMOVE" />
|
|
</InstallExecuteSequence>
|
|
|
|
<!-- ============================================================
|
|
Main feature (everything included)
|
|
============================================================ -->
|
|
<Feature Id="ProductFeature" Title="QElectroTech" Level="1">
|
|
<ComponentGroupRef Id="CG_AllFiles" />
|
|
<ComponentGroupRef Id="CG_Shortcuts" />
|
|
<ComponentGroupRef Id="CG_FileAssoc" />
|
|
</Feature>
|
|
|
|
<!-- WixUI_Minimal with QElectroTech GPL-2 license -->
|
|
<ui:WixUI Id="WixUI_Minimal" />
|
|
|
|
<!-- WixVariable without ui: namespace, at Package level -->
|
|
<WixVariable Id="WixUILicenseRtf" Value="$(var.LicenseRtf)" />
|
|
|
|
<!-- Properties shown in Programs and Features -->
|
|
<Property Id="ARPPRODUCTICON" Value="qet.ico" />
|
|
<Property Id="ARPHELPLINK" Value="https://qelectrotech.org" />
|
|
<Property Id="ARPURLINFOABOUT" Value="https://qelectrotech.org" />
|
|
<Property Id="ARPCOMMENTS" Value="Free electrical schematic editor" />
|
|
|
|
</Package>
|
|
</Wix>
|