iOS Pipeline in .NET MAUI Fails in Azure DevOps: xcrun "actool" Error

nandu kathmandi 1 Reputation point
2024-11-22T04:52:32.3866667+00:00

Hello,

I’m working on setting up an iOS pipeline for a .NET MAUI application in Azure DevOps using a YAML file. Locally, everything works as expected, but the pipeline fails with the following error:

xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null' failed with exit code 16384: (null) (errno=Invalid argument)

xcrun: error: unable to find utility "actool", not a developer tool or in PATH

What I've Tried

  1. Verified that Xcode is installed correctly on the pipeline by listing the Xcode versions and paths.
  2. Used xcode-select to ensure the correct version of Xcode is selected in the pipeline.
  3. Locally, the xcode path works fine when executed, and the xcrun path resolves correctly. However, in Azure DevOps, it fails to identify the actool path.
trigger:
- Jacobs-now-dev-mauicore

variables:
    BuildConfiguration: Release
    DotNetVersion: 8.0.303
    iOSVersion: net8.0-ios
    DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
    XCODE_PATH: /Applications/Xcode.app

parameters:
  - name: Version
    type: string
    default: '15.4'

pool:
  vmImage: 'macos-14'

steps:
- script: |
     echo Mac OS version:
     sw_vers -productVersion
     echo
     echo Installed Xcode versions:
     ls /Applications | grep 'Xcode'
     echo
     echo currently selected xcode:
     xcrun xcode-select --print-path
     echo
     echo selecting latest xcode...
     sudo xcode-select -s /Applications/Xcode.app
     xcrun xcode-select --print-path
     xcodebuild -version
  displayName: Select Xcode Version 

- task: UseDotNet@2
  displayName: 'Install .NET sdk'
  inputs:
    packageType: sdk
    version: 8.0.303
    installationPath: $(Agent.ToolsDirectory)/dotnet/sdk

- task: CmdLine@2
  displayName: 'Install Maui Workload'
  inputs:
    script: 'dotnet workload install maui'

- task: InstallAppleCertificate@2
  displayName: 'Install Apple P12 cert'
  inputs:
    certSecureFile: 'devtest.p12'
    certPwd: '******'
    keychain: 'temp'

- task: InstallAppleProvisioningProfile@1
  displayName: 'Install Apple Provisioning Profile'
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'comjacobsnowdev.mobileprovision'
    
- script: |
    dotnet restore
    dotnet build --configuration Release
    dotnet publish -f net8.0-ios /p:Configuration=Release /p:ArchiveOnBuild=true
  displayName: 'Build and Publish .ipa'

What could be causing the actool utility to not be found in Azure DevOps? and Is there a specific configuration required in Azure DevOps to ensure xcrun works correctly?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,655 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,958 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.