How can I solve the Assembly compression info not found for key '__CompressedAssembliesInfo in Azure pipeline builds
Asked Answered
C

1

7

I have created a new MAUI .NET 8.0 project (no changes from the default that Visual Studio 2022 creates) called TestMauiApp. I've then added a MAUI class library to the solution called MauiLibrary, and linked the class library in my project. When I build this on an Azure Pipeline I have this error:

"/Users/runner/work/1/s/TestMauiApp/TestMauiApp.sln" (SignAndroidPackage target) (1) ->
       "/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj" (SignAndroidPackage target) (3) ->
       (_BuildApkEmbed target) -> 
         /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009: System.InvalidOperationException: Assembly compression info not found for key '__CompressedAssembliesInfo:/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj'. Compression will not be performed. [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Xamarin.Android.Tasks.BuildApk.RunTask() [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]


I haven't been able to find information about this problem anywhere, so I'm not sure where to even start solving this problem.

Update 1

I was able to move past this error (or maybe just replace it with a different one) by adding the following line to my MauiLibrary csproj file.

<AndroidEnableAssemblyCompression>false</AndroidEnableAssemblyCompression>

By doing this, I now get a different error:

 "/Users/runner/work/1/s/TestMauiApp/TestMauiApp.sln" (SignAndroidPackage target) (1) ->
       "/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj" (SignAndroidPackage target) (3) ->
       (_BuildApkEmbed target) -> 
         /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009: System.InvalidOperationException: Assembly store generator did not generate any stores [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Xamarin.Android.Tasks.BuildApk.AddAssemblies(ZipArchiveEx apk, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo, String assemblyStoreApkName) [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo, String assemblyStoreApkName) [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Xamarin.Android.Tasks.BuildApk.RunTask() [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]
       /Users/runner/hostedtoolcache/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.43/tools/Xamarin.Android.Common.targets(2150,3): error XABBA7009:    at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 [/Users/runner/work/1/s/TestMauiApp/SkiaGum.Mobile/MauiLibrary.csproj::TargetFramework=net8.0-android]

I'm not sure if this is a valid workaround/solution, but it doesn't seem to solve the problem.

If I remove the MauiLibrary from the .sln completely, then I do not get any errors building the project.

How can I solve this?

Update 2

Here's the yaml file:

trigger:
- master

stages:

- stage: BuildiOS
  jobs:
  - job: BuildMAUIApps
    displayName: Build App
    pool:
      vmImage: 'macOS-12'
      demands:
      - MSBuild

    steps:
    - task: DownloadSecureFile@1
      displayName: 'TMA DownloadSecureFile keystore'
      name: keystore
      inputs:
        secureFile: 'platform.keystore'
        
    - task: UseDotNet@2
      displayName: .NET Version
      inputs:
        packageType: 'sdk'
        version: '8.0.100'

    - task: Bash@3
      displayName: Install MAUI
      inputs:
        targetType: 'inline'
        script: |
          dotnet nuget locals all --clear
          dotnet workload install android ios maui --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json

    - task: Bash@3
      displayName: Restore nuget
      inputs:
        targetType: 'inline'
        script: |
          cd TestMauiApp/
          dotnet restore TestMauiApp.sln --no-cache

    - task: Bash@3
      displayName: TMA Maui Build
      inputs:
        targetType: 'inline'
        script: |
          cd TestMauiApp/
          dotnet build -f net8.0-android -c Release -v d -t:SignAndroidPackage -p:AndroidPackageFormat=aab -p:AndroidKeyStore=True -p:AndroidSigningKeyStore=$(keystore.secureFilePath) -p:AndroidSigningStorePass=storePass -p:AndroidSigningKeyAlias=keyAlias -p:AndroidSigningKeyPass=keyPass

    - task: Bash@3
      displayName: 'build ls'
      inputs:
        targetType: 'inline'
        script: |
          ls
        workingDirectory: ${{ format('{0}{1}', variables['System.DefaultWorkingDirectory'], 'TestMauiApp/TestMauiApp/bin/Release/net8.0-android/') }}
        failOnStderr: true

    - task: CopyFiles@2
      displayName: 'TMA CopyFiles'
      inputs:
        SourceFolder: ${{ format('{0}{1}', variables['System.DefaultWorkingDirectory'], 'TestMauiApp/TestMauiApp/bin/Release/net8.0-android/') }}
        contents: '*Signed.aab'
        targetFolder: '$(build.artifactStagingDirectory)/AAB'

    - task: PublishBuildArtifacts@1
      displayName: 'TMA PublishBuildArtifacts'
      inputs:
        ArtifactName: 'AAB'
        pathtoPublish: '$(build.artifactStagingDirectory)/AAB'
Clay answered 7/12, 2023 at 21:1 Comment(1)
Could you share some of the yaml file? it seems you might have issues of >NET 8 not being installed or set properlyZsigmondy
A
2

I was able to resolve this by replacing the build step with the built in DotNetCoreCLI@2 task instead of a Bash cmd.

So I replaced this step:

- task: Bash@3
  displayName: TMA Maui Build
  inputs:
    targetType: 'inline'
    script: |
      cd TestMauiApp/
      dotnet build -f net8.0-android -c Release -v d -t:SignAndroidPackage -p:AndroidPackageFormat=aab -p:AndroidKeyStore=True -p:AndroidSigningKeyStore=$(keystore.secureFilePath) -p:AndroidSigningStorePass=storePass -p:AndroidSigningKeyAlias=keyAlias -p:AndroidSigningKeyPass=keyPass

With this:

- task: DotNetCoreCLI@2
  displayName: Build Android App
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: 'TestMauiApp/TestMauiApp.csproj'
    arguments: '-t:InstallAndroidDependencies -f net8.0-android -c Release -v d -t:SignAndroidPackage -p:AndroidPackageFormat=aab -p:AndroidKeyStore=True -p:AndroidSigningKeyStore=$(keystore.secureFilePath) -p:AndroidSigningStorePass=storePass -p:AndroidSigningKeyAlias=keyAlias -p:AndroidSigningKeyPass=keyPass'
    zipAfterPublish: false
    modifyOutputPath: false
Adjunction answered 23/8 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.