Skip to content

ACTool task fails build when xcrun actool cannot find tool #21762

Open
@AArnott

Description

@AArnott

Apple platform

iOS

Framework version

net8.0-, net9.0-

Affected platform version

.NET 9.0.100

Description

actool cannot be found, but only when in the context of dotnet build:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net9.0_18.1/18.1.9163/tools/msbuild/iOS/Xamarin.Shared.targets(907,3): /usr/bin/xcrun exited with code 72:
xcrun: error: sh -c '/Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)
xcrun: error: unable to find utility "actool", not a developer tool or in PATH [/Volumes/Expansion/git/nerdbank.cryptocurrencies/src/Nerdbank.Zcash.App/Nerdbank.Zcash.App.iOS/Nerdbank.Zcash.App.iOS.csproj]

If I take exactly the command line from the error message and execute it directly, in the same terminal where I spawned dotnet build, it works:

sh -c '/Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find actool 2> /dev/null'

I get the path to the actool printed in stdout.

I suspect then that the problem is environment variables set by the ACTool msbuild task, but I can't tell because that information isn't captured by the binlog.

Steps to Reproduce

With the .NET 9.0.101 SDK installed on a mac:

dotnet new maui

Modify the csproj to target .NET 9. (why does the .NET 9 SDK create a .NET 6 targeted maui project anyway??)
Use xcode-select to verify that Xcode 16.1 is selected.

dotnet build -f net9.0-ios

Problem repros.

Did you find any workaround?

No.

Build logs

binlog: msbuild.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue or pull request is an enhancementmsbuildIssues affecting our msbuild tasks/targets

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions