param( [string]$Configuration = "Release" ) $ErrorActionPreference = "Stop" $projectRoot = Split-Path -Parent $PSScriptRoot $dotnet = Join-Path $env:USERPROFILE ".dotnet10\dotnet.exe" $project = Join-Path $projectRoot "tools\LmeLicenseManager\LmeLicenseManager.csproj" $publishDirectory = Join-Path $projectRoot "tools\LmeLicenseManager\bin\$Configuration\net10.0-windows\win-x64\publish" $outputDirectory = Join-Path $projectRoot "artifacts\android-test" $archive = Join-Path $outputDirectory "LME-Pro-LicenseManager-win-x64.zip" if (-not (Test-Path -LiteralPath $dotnet)) { throw "SDK .NET 10 non trovato: $dotnet" } & $dotnet run --project $project -- --self-test if ($LASTEXITCODE -ne 0) { throw "Self-test del gestore licenze non riuscito." } & $dotnet publish $project -c $Configuration -r win-x64 --self-contained true if ($LASTEXITCODE -ne 0) { throw "Pubblicazione del gestore licenze non riuscita." } New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null if (Test-Path -LiteralPath $archive) { Remove-Item -LiteralPath $archive -Force } Compress-Archive -Path (Join-Path $publishDirectory "*") -DestinationPath $archive -CompressionLevel Optimal Get-Item -LiteralPath $archive | Select-Object Name, Length, LastWriteTime