param( [string]$Configuration = "Release", [string]$Runtime = "win-x64", [switch]$IncludeCurrentConfig, [switch]$SelfContained ) $ErrorActionPreference = "Stop" $projectDir = Split-Path -Parent $PSScriptRoot $workspaceDir = Split-Path -Parent $projectDir $projectPath = Join-Path $projectDir "TaskbarLauncher.csproj" [xml]$projectXml = Get-Content -LiteralPath $projectPath $version = $projectXml.Project.PropertyGroup.Version | Select-Object -First 1 if ([string]::IsNullOrWhiteSpace($version)) { $version = "0.0.0" } $packageKind = if ($SelfContained) { "self-contained" } else { "small" } $releaseRoot = Join-Path $workspaceDir "TaskbarLauncher-releases" $releaseDir = Join-Path $releaseRoot "TaskbarLauncher-v$version-$packageKind" $zipPath = Join-Path $releaseRoot "TaskbarLauncher-v$version-$packageKind.zip" $buildDir = Join-Path $workspaceDir "TaskbarLauncher-build-release-$packageKind" Get-Process TaskbarLauncher -ErrorAction SilentlyContinue | Stop-Process -Force if (Test-Path -LiteralPath $releaseDir) { Remove-Item -LiteralPath $releaseDir -Recurse -Force } New-Item -ItemType Directory -Path $releaseDir | Out-Null dotnet publish $projectPath ` -c $Configuration ` -r $Runtime ` --self-contained:$($SelfContained.IsPresent.ToString().ToLowerInvariant()) ` -p:PublishSingleFile=false ` -p:DebugType=None ` -p:DebugSymbols=false ` -p:BaseOutputPath="$buildDir\bin\" ` -p:BaseIntermediateOutputPath="$buildDir\obj\" ` -o $releaseDir Get-ChildItem -LiteralPath $releaseDir -Filter "*.pdb" -ErrorAction SilentlyContinue | Remove-Item -Force if ($IncludeCurrentConfig) { $configPath = Join-Path $workspaceDir "TaskbarLauncher-editor-publish\config.json" if (Test-Path -LiteralPath $configPath) { Copy-Item -LiteralPath $configPath -Destination (Join-Path $releaseDir "config.json") -Force } } $runtimeNote = if ($SelfContained) { "This package includes the .NET runtime. No separate .NET install is required." } else { "This small package requires Microsoft .NET 10 Desktop Runtime x64." } $readme = @" Taskbar Launcher v$version Requirements: - Windows x64 - $runtimeNote .NET 10 Desktop Runtime download: https://dotnet.microsoft.com/en-us/download/dotnet/10.0 Run: Double-click TaskbarLauncher.exe. Notes: - The app stores portable settings in config.json beside TaskbarLauncher.exe. - If config.json is missing, the app creates a clean starter config on first run. - Use Settings > Backup Config before making larger menu changes. "@ Set-Content -LiteralPath (Join-Path $releaseDir "README.txt") -Value $readme -Encoding UTF8 if (Test-Path -LiteralPath $zipPath) { Remove-Item -LiteralPath $zipPath -Force } Compress-Archive -Path (Join-Path $releaseDir "*") -DestinationPath $zipPath -Force $folderSize = (Get-ChildItem -LiteralPath $releaseDir -Recurse | Measure-Object -Property Length -Sum).Sum $zip = Get-Item -LiteralPath $zipPath [pscustomobject]@{ Version = $version PackageKind = $packageKind ReleaseFolder = $releaseDir ZipPath = $zip.FullName FolderBytes = $folderSize ZipBytes = $zip.Length }