Set-StrictMode -Off $ErrorActionPreference = 'Stop' # WiX 4 laeuft als x64-.NET-App. Auf ARM64-Windows (Parallels) liegt unter # C:\Program Files\dotnet nur die ARM64-Runtime — dann eine separat installierte # x64-Runtime bevorzugen, sonst faellt wix.exe mit "You must install .NET" aus. $x64Dotnet = "$env:USERPROFILE\dotnet-x64-install" if (Test-Path "$x64Dotnet\dotnet.exe") { $env:DOTNET_ROOT_X64 = $x64Dotnet $env:DOTNET_ROOT = $x64Dotnet } else { $env:DOTNET_ROOT = "C:\Program Files\dotnet" } $version = "0.1.32" $src = "\\Mac\Home\ClaudePRJ\Intune Manager" $stage = "$env:TEMP\IntuneManagerStage" $installerDir = "$src\installer" $harvestWxs = "$env:TEMP\AppFiles.wxs" # Echter Desktop-Pfad (auf Parallels ist der sichtbare Desktop der Mac-Desktop, # C:\Mac\Home\Desktop — NICHT C:\Users\\Desktop). $desktop = [Environment]::GetFolderPath('Desktop') $msi = "$desktop\IntuneManager-v$version.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=$version.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 }