AOT publish on macOS arm64 fails on .NET 11 with xcode-select/xcodebuild error
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
Publishing AOT artifacts on macOS arm64 fails on .NET 11 RC1 with `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`.
The same app/environment works when changing only `TargetFramework` from `net11.0` to `net10.0`.
This may be related to #100189, but this report is for .NET 11 behavior.
### Reproduction Steps
> dotnet new console -n aot-publish-test
```
The template "Console App" was created successfully.
Processing post-creation actions...
Restoring /Users/weihan.li/test/aot-publish-test/aot-publish-test.csproj:
Restore succeeded.
```
> cd ./aot-publish-test/ && cat ./aot-publish-test.csproj
```xml
Exe
net11.0
aot_publish_test
enable
enable
```
> dotnet publish -p PublishAot=true
```
Restore complete (1.4s)
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
aot-publish-test net11.0 osx-arm64 succeeded (2.8s) → bin/Release/net11.0/osx-arm64/publish/
xcode-select : error tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Build failed with 1 error(s) in 4.5s
```
### Expected behavior
Publish should success
### Actual behavior
Publish fails with:
```text
xcode-select : error tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
```
### Regression?
Change only `TargetFramework` to `net10.0` and run the same publish command; publish succeeds.
Works when updating target framework to net10.0 and with .NET 10 SDK
> dotnet publish -p PublishAot=true
```
Restore complete (0.1s)
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
aot-publish-test net10.0 osx-arm64 succeeded (2.0s) → bin/Release/net10.0/osx-arm64/publish/
Build succeeded in 2.1s
```
### Known Workarounds
_No response_
### Configuration
```
.NET SDK:
Version: 11.0.100-rc.1.26425.128
Commit: 3551975be0
Workload version: 11.0.100-manifests.a6e318ce
MSBuild version: 18.11.0-1.26425.128+3551975be
Runtime Environment:
OS Name: Mac OS X
OS Version: 26.6
OS Platform: Darwin
RID: osx-arm64
Base Path: /Users/weihan.li/Library/Application Support/dotnet/sdk/11.0.100-rc.1.26425.128
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 11.0.0-rc.1.26425.128
Architecture: arm64
Commit: 3551975be0
.NET SDKs installed:
10.0.401
11.0.100-rc.1.26425.128
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.12
Microsoft.AspNetCore.App 11.0.0-rc.1.26425.128
Microsoft.NETCore.App 10.0.12
Microsoft.NETCore.App 11.0.0-rc.1.26425.128
Environment variables:
DOTNET_ROOT=/Users/weihan.li/Library/Application Support/dotnet
```
### Other information
Possibly related to closed issue #100189 (`xcode-select : error : tool 'xcodebuild' requires Xcode - new error with nativeaot in .NET 9 preview 2`).
sdk issue created before: https://github.com/dotnet/sdk/issues/55296
Contributor guide
Research direction
Start with the aot-publish-test.csproj and reproduce the failure using `dotnet publish -p PublishAot=true` on macOS arm64 with net11.0. Compare the same project and command under net10.0, and review the xcode-select/xcodebuild error and related issues #100189 and sdk issue #55296. Done means the net11.0 publish succeeds in the reported environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, macos
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100