Füge WiX v6-kompatiblen MSI-Installer hinzu
- Erstelle generate_wix_files.py zum Ersetzen von 'wix heat' - Migriere DocuMentor.wxs auf WiX v4/v6-Syntax - Füge build_msi.py für automatisierten Build hinzu - Aktualisiere Dokumentation für WiX v6 - Erweitere .gitignore für WiX-Artefakte WiX v6 hat das 'heat' Tool entfernt, daher wurde ein Python-Skript erstellt, das automatisch alle Dateien aus dist/DocuMentor harvested und eine WiX-konforme ProductFiles.wxs generiert. Der neue Build-Prozess: 1. uv run python build_windows.py 2. uv run python generate_wix_files.py 3. wix build DocuMentor.wxs ProductFiles.wxs -o DocuMentor.msi Oder vereinfacht: uv run python build_msi.py
This commit is contained in:
+24
-172
@@ -51,10 +51,8 @@ Dies erstellt:
|
||||
|
||||
**Voraussetzungen:**
|
||||
```bash
|
||||
# WiX Toolset v4 installieren (empfohlen)
|
||||
# WiX Toolset v6 installieren (aktuell)
|
||||
dotnet tool install --global wix
|
||||
|
||||
# Oder WiX v3 von https://wixtoolset.org/releases/
|
||||
```
|
||||
|
||||
**Schritt 1: PyInstaller Build erstellen**
|
||||
@@ -62,166 +60,33 @@ dotnet tool install --global wix
|
||||
uv run python build_windows.py
|
||||
```
|
||||
|
||||
**Schritt 2: WiX-Konfiguration erstellen (`DocuMentor.wxs`):**
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
|
||||
<!-- Produkt-Definition -->
|
||||
<Product
|
||||
Id="*"
|
||||
Name="DocuMentor"
|
||||
Language="1031"
|
||||
Version="0.1.0"
|
||||
Manufacturer="Ihr Name/Firma"
|
||||
UpgradeCode="PUT-YOUR-UPGRADE-GUID-HERE">
|
||||
|
||||
<Package
|
||||
InstallerVersion="200"
|
||||
Compressed="yes"
|
||||
InstallScope="perMachine"
|
||||
Description="Professionelle XSL-Transformations-Verwaltung"
|
||||
Comments="DocuMentor - XSL/PDF Management Tool" />
|
||||
**Schritt 2: ProductFiles.wxs generieren**
|
||||
|
||||
<!-- Upgrade-Logik (deinstalliert alte Versionen) -->
|
||||
<MajorUpgrade
|
||||
DowngradeErrorMessage="Eine neuere Version ist bereits installiert."
|
||||
AllowSameVersionUpgrades="yes" />
|
||||
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
**WICHTIG**: WiX v6 hat das `heat` Tool entfernt. Stattdessen verwenden wir ein Python-Skript:
|
||||
|
||||
<!-- Feature-Definition -->
|
||||
<Feature Id="ProductFeature" Title="DocuMentor" Level="1">
|
||||
<ComponentGroupRef Id="ProductComponents" />
|
||||
<ComponentRef Id="ApplicationShortcut" />
|
||||
<ComponentRef Id="DesktopShortcut" />
|
||||
</Feature>
|
||||
|
||||
<!-- UI-Dialoge (Standard-Installer-Oberfläche) -->
|
||||
<UIRef Id="WixUI_InstallDir" />
|
||||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
|
||||
|
||||
<!-- Icon für Programme und Funktionen -->
|
||||
<Icon Id="icon.ico" SourceFile="resources\icon.ico"/>
|
||||
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
|
||||
|
||||
<!-- Website-Link in Systemsteuerung -->
|
||||
<Property Id="ARPHELPLINK" Value="https://github.com/IhrRepo/DocuMentor" />
|
||||
</Product>
|
||||
|
||||
<!-- Fragment: Verzeichnisstruktur -->
|
||||
<Fragment>
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
<Directory Id="INSTALLFOLDER" Name="DocuMentor" />
|
||||
</Directory>
|
||||
|
||||
<!-- Start-Menü -->
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="DocuMentor"/>
|
||||
</Directory>
|
||||
|
||||
<!-- Desktop -->
|
||||
<Directory Id="DesktopFolder" Name="Desktop" />
|
||||
</Directory>
|
||||
</Fragment>
|
||||
|
||||
<!-- Fragment: Komponenten (Dateien) -->
|
||||
<Fragment>
|
||||
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
|
||||
<!-- Hauptexecutable -->
|
||||
<Component Id="MainExecutable" Guid="PUT-COMPONENT-GUID-HERE">
|
||||
<File Id="DocuMentorEXE" Source="dist\DocuMentor\DocuMentor.exe" KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
<!-- Alle weiteren Dateien aus dist/DocuMentor/ -->
|
||||
<!-- HINWEIS: In Produktion heat.exe verwenden für automatisches Harvesting -->
|
||||
<Component Id="AllFiles" Guid="PUT-COMPONENT-GUID-HERE-2">
|
||||
<File Id="AllFilesMarker" Source="dist\DocuMentor\*" KeyPath="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<!-- Start-Menü Verknüpfung -->
|
||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||
<Component Id="ApplicationShortcut" Guid="PUT-COMPONENT-GUID-HERE-3">
|
||||
<Shortcut
|
||||
Id="ApplicationStartMenuShortcut"
|
||||
Name="DocuMentor"
|
||||
Description="XSL-Transformations-Verwaltung"
|
||||
Target="[INSTALLFOLDER]DocuMentor.exe"
|
||||
WorkingDirectory="INSTALLFOLDER"
|
||||
Icon="icon.ico" />
|
||||
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\DocuMentor"
|
||||
Name="installed"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<!-- Desktop Verknüpfung (optional) -->
|
||||
<DirectoryRef Id="DesktopFolder">
|
||||
<Component Id="DesktopShortcut" Guid="PUT-COMPONENT-GUID-HERE-4">
|
||||
<Shortcut
|
||||
Id="DesktopShortcut"
|
||||
Name="DocuMentor"
|
||||
Target="[INSTALLFOLDER]DocuMentor.exe"
|
||||
WorkingDirectory="INSTALLFOLDER"
|
||||
Icon="icon.ico" />
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\DocuMentor"
|
||||
Name="desktopShortcut"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
```
|
||||
|
||||
**Schritt 3: GUIDs generieren**
|
||||
```bash
|
||||
# GUIDs mit PowerShell generieren
|
||||
powershell -Command "[guid]::NewGuid()"
|
||||
|
||||
# Oder Python-Skript verwenden
|
||||
uv run python generate_guid.py
|
||||
# Generiert automatisch ProductFiles.wxs mit allen Dateien aus dist/DocuMentor
|
||||
uv run python generate_wix_files.py
|
||||
```
|
||||
|
||||
**Schritt 4: Dateien automatisch harvesten (empfohlen)**
|
||||
**Schritt 3: MSI kompilieren**
|
||||
```bash
|
||||
# WiX v3: Heat Tool verwenden
|
||||
heat dir dist\DocuMentor -cg ProductComponents -gg -sfrag -srd -dr INSTALLFOLDER -out ProductFiles.wxs
|
||||
|
||||
# WiX v4:
|
||||
wix heat dir dist\DocuMentor -cg ProductComponents -gg -sfrag -srd -dr INSTALLFOLDER -out ProductFiles.wxs
|
||||
# WiX v6 Build
|
||||
wix build DocuMentor.wxs ProductFiles.wxs -o DocuMentor.msi
|
||||
```
|
||||
|
||||
**Schritt 5: MSI kompilieren**
|
||||
```bash
|
||||
# WiX v3
|
||||
candle DocuMentor.wxs -out obj\
|
||||
light obj\DocuMentor.wixobj -out dist\installer\DocuMentor-0.1.0.msi -ext WixUIExtension
|
||||
**Hinweis**: Die Dateien `DocuMentor.wxs` und `generate_wix_files.py` sind bereits im Repository vorhanden und WiX v4/v6-kompatibel.
|
||||
|
||||
# WiX v4
|
||||
wix build DocuMentor.wxs -out dist\installer\DocuMentor-0.1.0.msi
|
||||
```
|
||||
|
||||
**Schritt 6: MSI testen**
|
||||
**Schritt 4: MSI testen**
|
||||
```bash
|
||||
# Installation (als Administrator)
|
||||
msiexec /i dist\installer\DocuMentor-0.1.0.msi
|
||||
msiexec /i DocuMentor.msi
|
||||
|
||||
# Silent Installation für Deployment
|
||||
msiexec /i DocuMentor-0.1.0.msi /quiet /qn /norestart
|
||||
msiexec /i DocuMentor.msi /quiet /qn /norestart
|
||||
|
||||
# Deinstallation
|
||||
msiexec /x dist\installer\DocuMentor-0.1.0.msi
|
||||
msiexec /x DocuMentor.msi
|
||||
```
|
||||
|
||||
**MSI-Vorteile gegenüber Inno Setup:**
|
||||
@@ -234,7 +99,7 @@ msiexec /x dist\installer\DocuMentor-0.1.0.msi
|
||||
|
||||
**Build-Automatisierung (`build_msi.py`):**
|
||||
```python
|
||||
"""WiX MSI Build-Skript für DocuMentor"""
|
||||
"""WiX MSI Build-Skript für DocuMentor (WiX v6)"""
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -247,35 +112,22 @@ def build_msi():
|
||||
print("Fehler: PyInstaller Build nicht gefunden. Erst build_windows.py ausführen!")
|
||||
sys.exit(1)
|
||||
|
||||
# Heat: Dateien harvesten
|
||||
print("Harvesting Dateien mit Heat...")
|
||||
# Schritt 1: ProductFiles.wxs generieren (ersetzt heat)
|
||||
print("Generiere ProductFiles.wxs...")
|
||||
subprocess.run([
|
||||
"heat", "dir", str(dist_dir),
|
||||
"-cg", "ProductComponents",
|
||||
"-gg", "-sfrag", "-srd",
|
||||
"-dr", "INSTALLFOLDER",
|
||||
"-out", "ProductFiles.wxs"
|
||||
"uv", "run", "python", "generate_wix_files.py"
|
||||
], check=True)
|
||||
|
||||
# Candle: WXS zu WIXOBJ kompilieren
|
||||
print("Kompiliere WXS-Dateien...")
|
||||
# Schritt 2: MSI kompilieren mit WiX v6
|
||||
print("Kompiliere MSI-Installer...")
|
||||
subprocess.run([
|
||||
"candle", "DocuMentor.wxs", "ProductFiles.wxs",
|
||||
"-out", "obj\\"
|
||||
"wix", "build",
|
||||
"DocuMentor.wxs",
|
||||
"ProductFiles.wxs",
|
||||
"-o", "DocuMentor.msi"
|
||||
], check=True)
|
||||
|
||||
# Light: WIXOBJ zu MSI linken
|
||||
print("Erzeuge MSI-Installer...")
|
||||
(project_root / "dist" / "installer").mkdir(exist_ok=True)
|
||||
subprocess.run([
|
||||
"light",
|
||||
"obj\\DocuMentor.wixobj",
|
||||
"obj\\ProductFiles.wixobj",
|
||||
"-out", "dist\\installer\\DocuMentor-0.1.0.msi",
|
||||
"-ext", "WixUIExtension"
|
||||
], check=True)
|
||||
|
||||
print("\n✅ MSI erstellt: dist\\installer\\DocuMentor-0.1.0.msi")
|
||||
print("\n[OK] MSI erstellt: DocuMentor.msi")
|
||||
|
||||
if __name__ == "__main__":
|
||||
build_msi()
|
||||
|
||||
Reference in New Issue
Block a user