MSI-Build: WiX 4.0.6 mit PowerShell-Fragment-Generator
- WiX auf Version 4.0.6 festgenagelt (keine OSMF-EULA-Pflicht wie bei v7) - harvest-Subcommand entfernt (nicht in 4.0.6 verfügbar) - Fragment-Generierung (AppFiles.wxs) direkt via PowerShell XML-API - Extension auf WixToolset.UI.wixext/4.0.6 fixiert - build-local.ps1 für lokale Tests in der Windows-VM - Lokaler Build erfolgreich getestet: 1.5 MB MSI, Installer-Wizard OK Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,16 +38,50 @@ jobs:
|
|||||||
- name: Install WiX Toolset v4
|
- name: Install WiX Toolset v4
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
dotnet tool install --global wix
|
dotnet tool install --global wix --version "4.0.6"
|
||||||
wix extension add WixToolset.UI.wixext --global
|
wix extension add "WixToolset.UI.wixext/4.0.6" --global
|
||||||
|
|
||||||
|
- name: Generate WiX file fragment
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$stage = "${{ runner.temp }}\stage"
|
||||||
|
$harvestWxs = "${{ runner.temp }}\AppFiles.wxs"
|
||||||
|
$ns = "http://wixtoolset.org/schemas/v4/wxs"
|
||||||
|
$doc = [System.Xml.XmlDocument]::new()
|
||||||
|
$doc.AppendChild($doc.CreateXmlDeclaration("1.0","UTF-8",$null)) | Out-Null
|
||||||
|
$wix = $doc.CreateElement("Wix", $ns); $doc.AppendChild($wix) | Out-Null
|
||||||
|
$frag = $doc.CreateElement("Fragment", $ns); $wix.AppendChild($frag) | Out-Null
|
||||||
|
$cg = $doc.CreateElement("ComponentGroup", $ns)
|
||||||
|
$cg.SetAttribute("Id","AppFiles"); $cg.SetAttribute("Directory","INSTALLFOLDER")
|
||||||
|
$frag.AppendChild($cg) | Out-Null
|
||||||
|
$idx = 0
|
||||||
|
Get-ChildItem -Path $stage -Recurse -File | ForEach-Object {
|
||||||
|
$rel = $_.FullName.Substring($stage.Length + 1)
|
||||||
|
$relDir = [System.IO.Path]::GetDirectoryName($rel)
|
||||||
|
$comp = $doc.CreateElement("Component", $ns)
|
||||||
|
$comp.SetAttribute("Id", "Comp_$idx")
|
||||||
|
$comp.SetAttribute("Guid", ("{$([System.Guid]::NewGuid().ToString().ToUpper())}"))
|
||||||
|
if ($relDir) { $comp.SetAttribute("Subdirectory", $relDir) }
|
||||||
|
$cg.AppendChild($comp) | Out-Null
|
||||||
|
$f = $doc.CreateElement("File", $ns)
|
||||||
|
$f.SetAttribute("Id", "File_$idx")
|
||||||
|
$f.SetAttribute("Source", "`$(var.SourceDir)\$rel")
|
||||||
|
$f.SetAttribute("KeyPath", "yes")
|
||||||
|
$comp.AppendChild($f) | Out-Null
|
||||||
|
$idx++
|
||||||
|
}
|
||||||
|
$doc.Save($harvestWxs)
|
||||||
|
Write-Host "Fragment: $harvestWxs ($idx files)"
|
||||||
|
|
||||||
- name: Build MSI
|
- name: Build MSI
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$stage = "${{ runner.temp }}\stage"
|
$stage = "${{ runner.temp }}\stage"
|
||||||
|
$harvestWxs = "${{ runner.temp }}\AppFiles.wxs"
|
||||||
$installerDir = "${{ github.workspace }}\installer"
|
$installerDir = "${{ github.workspace }}\installer"
|
||||||
$msiName = "IntuneManager-${{ steps.ver.outputs.TAG }}.msi"
|
$msiName = "IntuneManager-${{ steps.ver.outputs.TAG }}.msi"
|
||||||
wix build installer\Intune-Manager.wxs `
|
wix build installer\Intune-Manager.wxs $harvestWxs `
|
||||||
|
-ext WixToolset.UI.wixext `
|
||||||
-d Version=${{ steps.ver.outputs.VERSION }} `
|
-d Version=${{ steps.ver.outputs.VERSION }} `
|
||||||
-d SourceDir=$stage `
|
-d SourceDir=$stage `
|
||||||
-d InstallerDir=$installerDir `
|
-d InstallerDir=$installerDir `
|
||||||
|
|||||||
@@ -21,16 +21,10 @@
|
|||||||
<ComponentRef Id="StartMenuShortcut" />
|
<ComponentRef Id="StartMenuShortcut" />
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
<!-- Installation directory -->
|
|
||||||
<StandardDirectory Id="ProgramFiles64Folder">
|
<StandardDirectory Id="ProgramFiles64Folder">
|
||||||
<Directory Id="INSTALLFOLDER" Name="Intune Manager" />
|
<Directory Id="INSTALLFOLDER" Name="Intune Manager" />
|
||||||
</StandardDirectory>
|
</StandardDirectory>
|
||||||
|
|
||||||
<!-- All application files (harvested from staging dir) -->
|
|
||||||
<ComponentGroup Id="AppFiles" Directory="INSTALLFOLDER">
|
|
||||||
<Files Source="$(var.SourceDir)\**" />
|
|
||||||
</ComponentGroup>
|
|
||||||
|
|
||||||
<!-- Start Menu shortcut -->
|
<!-- Start Menu shortcut -->
|
||||||
<StandardDirectory Id="ProgramMenuFolder">
|
<StandardDirectory Id="ProgramMenuFolder">
|
||||||
<Directory Id="AppMenuDir" Name="Intune Manager">
|
<Directory Id="AppMenuDir" Name="Intune Manager">
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
Set-StrictMode -Off
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$env:DOTNET_ROOT = "C:\Program Files\dotnet"
|
||||||
|
|
||||||
|
$src = "\\Mac\Home\ClaudePRJ\Intune Manager"
|
||||||
|
$stage = "$env:TEMP\IntuneManagerStage"
|
||||||
|
$installerDir = "$src\installer"
|
||||||
|
$harvestWxs = "$env:TEMP\AppFiles.wxs"
|
||||||
|
$msi = "$env:USERPROFILE\Desktop\IntuneManager-v0.1.24.msi"
|
||||||
|
|
||||||
|
# --- WixUI Extension installieren (Version passend zu WiX 4.0.6) ---
|
||||||
|
Write-Host "=== Extension ===" -ForegroundColor Cyan
|
||||||
|
wix extension add "WixToolset.UI.wixext/4.0.6" --global 2>&1 | Write-Host
|
||||||
|
|
||||||
|
# --- Staging ---
|
||||||
|
Write-Host "`n=== Staging ===" -ForegroundColor Cyan
|
||||||
|
if (Test-Path $stage) { Remove-Item $stage -Recurse -Force }
|
||||||
|
New-Item -ItemType Directory $stage | Out-Null
|
||||||
|
Get-ChildItem -Path $src -Exclude '.git','.github','installer' |
|
||||||
|
Copy-Item -Destination $stage -Recurse -Force
|
||||||
|
Write-Host "Staging: $stage"
|
||||||
|
|
||||||
|
# --- AppFiles.wxs Fragment generieren ---
|
||||||
|
Write-Host "`n=== Fragment generieren ===" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
$ns = "http://wixtoolset.org/schemas/v4/wxs"
|
||||||
|
$doc = [System.Xml.XmlDocument]::new()
|
||||||
|
$decl = $doc.CreateXmlDeclaration("1.0","UTF-8",$null)
|
||||||
|
$doc.AppendChild($decl) | Out-Null
|
||||||
|
|
||||||
|
$wix = $doc.CreateElement("Wix", $ns); $doc.AppendChild($wix) | Out-Null
|
||||||
|
$frag = $doc.CreateElement("Fragment", $ns); $wix.AppendChild($frag) | Out-Null
|
||||||
|
$cg = $doc.CreateElement("ComponentGroup", $ns)
|
||||||
|
$cg.SetAttribute("Id","AppFiles"); $cg.SetAttribute("Directory","INSTALLFOLDER")
|
||||||
|
$frag.AppendChild($cg) | Out-Null
|
||||||
|
|
||||||
|
$dirIdx = @{}
|
||||||
|
$idx = 0
|
||||||
|
Get-ChildItem -Path $stage -Recurse -File | ForEach-Object {
|
||||||
|
$rel = $_.FullName.Substring($stage.Length + 1) # e.g. www\app.js
|
||||||
|
$relDir = [System.IO.Path]::GetDirectoryName($rel) # e.g. www
|
||||||
|
|
||||||
|
$comp = $doc.CreateElement("Component", $ns)
|
||||||
|
$comp.SetAttribute("Id", "Comp_$idx")
|
||||||
|
$comp.SetAttribute("Guid", ("{$([System.Guid]::NewGuid().ToString().ToUpper())}"))
|
||||||
|
if ($relDir) { $comp.SetAttribute("Subdirectory", $relDir) }
|
||||||
|
$cg.AppendChild($comp) | Out-Null
|
||||||
|
|
||||||
|
$f = $doc.CreateElement("File", $ns)
|
||||||
|
$f.SetAttribute("Id", "File_$idx")
|
||||||
|
$f.SetAttribute("Source", "`$(var.SourceDir)\$rel")
|
||||||
|
$f.SetAttribute("KeyPath", "yes")
|
||||||
|
$comp.AppendChild($f) | Out-Null
|
||||||
|
$idx++
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc.Save($harvestWxs)
|
||||||
|
Write-Host "Fragment: $harvestWxs ($idx Dateien)"
|
||||||
|
|
||||||
|
# --- MSI bauen ---
|
||||||
|
Write-Host "`n=== MSI bauen ===" -ForegroundColor Cyan
|
||||||
|
wix build "$installerDir\Intune-Manager.wxs" $harvestWxs `
|
||||||
|
-ext WixToolset.UI.wixext `
|
||||||
|
-d Version=0.1.24.0 `
|
||||||
|
-d SourceDir=$stage `
|
||||||
|
-d InstallerDir=$installerDir `
|
||||||
|
-o $msi
|
||||||
|
|
||||||
|
if (Test-Path $msi) {
|
||||||
|
$size = [math]::Round((Get-Item $msi).Length / 1MB, 1)
|
||||||
|
Write-Host "`nERFOLG: $msi ($size MB)" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "`nFEHLER: MSI wurde nicht erstellt." -ForegroundColor Red
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user