param( [string]$KeystorePath = (Join-Path $PSScriptRoot '..\\cfs-tracker.keystore'), [string]$StorePass = $env:ANDROID_STORE_PASS, [string]$KeyAlias = $env:ANDROID_KEY_ALIAS, [string]$KeyPass = $env:ANDROID_KEY_PASS ) $ErrorActionPreference = 'Stop' $resolvedKeystorePath = (Resolve-Path $KeystorePath).Path if (-not $StorePass) { throw 'ANDROID_STORE_PASS fehlt. Setze die Umgebungsvariable oder uebergib -StorePass.' } if (-not $KeyAlias) { throw 'ANDROID_KEY_ALIAS fehlt. Setze die Umgebungsvariable oder uebergib -KeyAlias.' } if (-not $KeyPass) { $KeyPass = $StorePass } $outputDir = Join-Path $PSScriptRoot '..\\bin\\Release\\net10.0-android' $publishDir = Join-Path $outputDir 'publish' $artifactsToDelete = @( (Join-Path $outputDir 'com.companyname.cfstracker-Signed.aab'), (Join-Path $outputDir 'com.companyname.cfstracker.aab'), (Join-Path $publishDir 'com.companyname.cfstracker-Signed.aab'), (Join-Path $publishDir 'com.companyname.cfstracker.aab') ) foreach ($artifact in $artifactsToDelete) { if (Test-Path $artifact) { Remove-Item -LiteralPath $artifact -Force } } $publishArgs = @( 'build', '.\\cfs-tracker.csproj', '-f', 'net10.0-android', '-c', 'Release', '-t:SignAndroidPackage', '-p:AndroidPackageFormat=aab', '-p:RunAOTCompilation=false', '-p:AndroidEnableProfiledAot=false', '-p:AndroidKeyStore=true', "-p:AndroidSigningKeyStore=$resolvedKeystorePath", "-p:AndroidSigningStorePass=$StorePass", "-p:AndroidSigningKeyAlias=$KeyAlias", "-p:AndroidSigningKeyPass=$KeyPass" ) & dotnet @publishArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $resolvedPublishDir = (Resolve-Path $publishDir).Path Get-ChildItem $resolvedPublishDir -Filter *.aab | Select-Object FullName, Length, LastWriteTime