Answers: <p>It's hard to know the problem without having the error messages.
  Try to compare the last successful build and the build that is not working.</p>
  <p>In case this would help.
  I had a similar issue a couple of days ago when building an ios app.
  I realized that the problem resides in the step <strong>installing MAUI</strong>.
  Azure pipeline was using a different sdk which was causing the problem.</p>
  <p>I had to add --from-rollback-file
  <strong>dotnet workload install maui --from-rollback-file MauiJson.json</strong></p>
  <p>Thanks to <a href="https://Alvin%20Zhao%20-%20MSFT" rel="nofollow noreferrer">https://stackoverflow.com/users/16600319/alvin-zhao-msft</a>
  I was able to fix the issue with the installable MAUI app on azure devops.</p>
  <p><a href="https://stackoverflow.com/questions/78076656/azure-devops-pipeline-rollback-file-for-net-maui-install-fails-with-is-an-i">https://stackoverflow.com/questions/78076656/azure-devops-pipeline-rollback-file-for-net-maui-install-fails-with-is-an-i</a></p>
  <blockquote>
  <pre><code>  parameters:
    - name: MauiJson
      type: object
      default:
        microsoft.net.sdk.ios: 17.5.8021/8.0.101
        microsoft.net.sdk.maui : 8.0.81/8.0.101
        microsoft.net.sdk.maccatalyst : 17.5.8021/8.0.101
        microsoft.net.sdk.macos : 14.5.8021/8.0.101
        microsoft.net.sdk.android : 34.0.130/8.0.101
  
      variables:
      - name : 'MauiJson'
        value : ${{ convertToJson(parameters.MauiJson) }}
  
      - task: Bash@3
        displayName: Install MAUI
        inputs:
          targetType: 'inline'
          script: |
            cat MauiJson.json
            dotnet nuget locals all --clear
            dotnet workload install maui --from-rollback-file MauiJson.json --source
  </code></pre>
  <p><a href="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" rel="nofollow noreferrer">https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json</a>
  --source <a href="https://api.nuget.org/v3/index.json" rel="nofollow noreferrer">https://api.nuget.org/v3/index.json</a></p>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2024-09-29T12:30:45.013Z
Answers: 2024-09-29T12:30:45.013Z
Answers: samir khouzam
Body: <p>We have an Azure pipeline which builds and sign a MAUI app, then uploads to Dropbox from where we can download it and install it to phones. It was working fine until at some point the app stopped installing and now every Android device just says &quot;can't install application&quot;.</p>
  <p>My first thought was that maybe we had some certificate which has expired and needed renewal but after reviewing the YAML file for the pipeline I can see no certificate being used. I'm confused as to what broke.</p>
  <p>The YAML file:</p>
  <pre><code># Starter pipeline
  # Start with a minimal pipeline that you can customize to build and deploy your code.
  # Add steps that build, run tests, deploy, and more:
  # https://aka.ms/yaml
  
  trigger:
  - main
  
  variables:
      BuildConfiguration: Release
      DotNetVersion: 8.0.100
      VSVERSION: 17/pre
  
  stages:
  - stage: BuildAndroid
    jobs:
    - job: BuildMAUIApps
      displayName: Build MyApp
      pool:
        vmImage: 'windows-2022'
        demands:
        - MSBuild
        
      steps:
      
      - task: UseDotNet@2
        displayName: .NET Version
        inputs:
          packageType: 'sdk'
          version: '$(DotNetVersion)'
      
      - task: Bash@3
        displayName: Install MAUI
        inputs:
          targetType: 'inline'
          script: |
            dotnet nuget locals all --clear 
            dotnet workload install maui --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
            dotnet workload install android maui wasm-tools --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 src
            dotnet restore MyApp.sln
      
      - task: DotNetCoreCLI@2
        displayName: Run tests
        inputs:
          command: 'test'
          projects: 'src\MyApp.sln'
  
  
      # https://docs.microsoft.com/en-us/dotnet/maui/android/deployment/overview
      - task: Bash@3
        displayName: Build Android app
        inputs:
          targetType: 'inline'
          script: |
            cd src
            dotnet build MyApp.sln -c Release
  
      # Signing Android App : https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/mobile/app-signing?view=azure-devops&amp;tabs=apple-install-during-build#sign-your-android-app
  
      - task: CopyFiles@2
        inputs:
          Contents: 'src\MyApp\bin\Release\net8.0-android\*.apk'
          TargetFolder: '$(Build.ArtifactStagingDirectory)'
          CleanTargetFolder: true
          OverWrite: true
          flattenFolders: true
      
      - task: CmdLine@2
        displayName: Rename apk
        inputs:
          script: 'REN $(Build.ArtifactStagingDirectory)\com.mydomain.MyApp.apk MyApp.apk'
  
      - task: PublishBuildArtifacts@1
        inputs:
          PathtoPublish: '$(Build.ArtifactStagingDirectory)'
          ArtifactName: 'drop_android'
          publishLocation: 'Container'
      - task: ZipAndDropBox@0
        displayName: ZipAndDropBox
        inputs:
          sourceDir: '$(build.artifactstagingdirectory)'
          zipPath: '/company/MyApp_Droid.zip'
      - task: SendGridEmail@2
        inputs:
          SendGridApiKey: '$(SendGridToken)'
          FromAddress: 'val@mydomain.com'
          ToAddresses: 'val@mydomain.com,tester@mydomain.com'
          Subject: 'New version of MyApp'
          emailBodyFormat: 'InLine'
          EmailBody: |
            The new version is here: 
            
            https://www.dropbox.com/pathtofile
            
  </code></pre>
  
Tags: <azure-pipelines><yaml>
Title: Azure pipeline stopped producing installable MAUI app
UserDisplayName: Val
ThreadText: # Azure pipeline stopped producing installable MAUI app
  
  (Asked by: username_0 on 2024-08-30)
  
  We have an Azure pipeline which builds and sign a MAUI app, then uploads to Dropbox from where we can download it and install it to phones. It was working fine until at some point the app stopped installing and now every Android device just says "can't install application".
  
  My first thought was that maybe we had some certificate which has expired and needed renewal but after reviewing the YAML file for the pipeline I can see no certificate being used. I'm confused as to what broke.
  
  The YAML file:
  
  ```
  # Starter pipeline
  # Start with a minimal pipeline that you can customize to build and deploy your code.
  # Add steps that build, run tests, deploy, and more:
  # https://aka.ms/yaml
  
  trigger:
  - main
  
  variables:
      BuildConfiguration: Release
      DotNetVersion: 8.0.100
      VSVERSION: 17/pre
  
  stages:
  - stage: BuildAndroid
    jobs:
    - job: BuildMAUIApps
      displayName: Build MyApp
      pool:
        vmImage: 'windows-2022'
        demands:
        - MSBuild
        
      steps:
      
      - task: UseDotNet@2
        displayName: .NET Version
        inputs:
          packageType: 'sdk'
          version: '$(DotNetVersion)'
      
      - task: Bash@3
        displayName: Install MAUI
        inputs:
          targetType: 'inline'
          script: |
            dotnet nuget locals all --clear 
            dotnet workload install maui --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
            dotnet workload install android maui wasm-tools --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 src
            dotnet restore MyApp.sln
      
      - task: DotNetCoreCLI@2
        displayName: Run tests
        inputs:
          command: 'test'
          projects: 'src\MyApp.sln'
  
      # https://docs.microsoft.com/en-us/dotnet/maui/android/deployment/overview
      - task: Bash@3
        displayName: Build Android app
        inputs:
          targetType: 'inline'
          script: |
            cd src
            dotnet build MyApp.sln -c Release
  
      # Signing Android App : https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/mobile/app-signing?view=azure-devops&tabs=apple-install-during-build#sign-your-android-app
  
      - task: CopyFiles@2
        inputs:
          Contents: 'src\MyApp\bin\Release\net8.0-android\*.apk'
          TargetFolder: '$(Build.ArtifactStagingDirectory)'
          CleanTargetFolder: true
          OverWrite: true
          flattenFolders: true
      
      - task: CmdLine@2
        displayName: Rename apk
        inputs:
          script: 'REN $(Build.ArtifactStagingDirectory)\com.mydomain.MyApp.apk MyApp.apk'
  
      - task: PublishBuildArtifacts@1
        inputs:
          PathtoPublish: '$(Build.ArtifactStagingDirectory)'
          ArtifactName: 'drop_android'
          publishLocation: 'Container'
      - task: ZipAndDropBox@0
        displayName: ZipAndDropBox
        inputs:
          sourceDir: '$(build.artifactstagingdirectory)'
          zipPath: '/company/MyApp_Droid.zip'
      - task: SendGridEmail@2
        inputs:
          SendGridApiKey: '$(SendGridToken)'
          FromAddress: 'val@mydomain.com'
          ToAddresses: 'val@mydomain.com,tester@mydomain.com'
          Subject: 'New version of MyApp'
          emailBodyFormat: 'InLine'
          EmailBody: |
            The new version is here: 
            
            https://www.dropbox.com/pathtofile
            
  
  ```
  
  **Tags:** azure-pipelines, yaml
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-09-29. Score: 0
  
  It's hard to know the problem without having the error messages.
  Try to compare the last successful build and the build that is not working.
  
  In case this would help.
  I had a similar issue a couple of days ago when building an ios app.
  I realized that the problem resides in the step **installing MAUI**.
  Azure pipeline was using a different sdk which was causing the problem.
  
  I had to add --from-rollback-file
  **dotnet workload install maui --from-rollback-file MauiJson.json**
  
  Thanks to [https://stackoverflow.com/users/16600319/alvin-zhao-msft](https://Alvin%20Zhao%20-%20MSFT)
  I was able to fix the issue with the installable MAUI app on azure devops.
  
  <https://stackoverflow.com/questions/78076656/azure-devops-pipeline-rollback-file-for-net-maui-install-fails-with-is-an-i>
  
  > ```
  >   parameters:
  >   - name: MauiJson
  >     type: object
  >     default:
  >       microsoft.net.sdk.ios: 17.5.8021/8.0.101
  >       microsoft.net.sdk.maui : 8.0.81/8.0.101
  >       microsoft.net.sdk.maccatalyst : 17.5.8021/8.0.101
  >       microsoft.net.sdk.macos : 14.5.8021/8.0.101
  >       microsoft.net.sdk.android : 34.0.130/8.0.101
  >
  >     variables:
  >     - name : 'MauiJson'
  >       value : ${{ convertToJson(parameters.MauiJson) }}
  >
  >     - task: Bash@3
  >       displayName: Install MAUI
  >       inputs:
  >         targetType: 'inline'
  >         script: |
  >           cat MauiJson.json
  >           dotnet nuget locals all --clear
  >           dotnet workload install maui --from-rollback-file MauiJson.json --source
  >
  > ```
  >
  > <https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json>
  > --source <https://api.nuget.org/v3/index.json>
  
  
  ---
  
  