Reproduction steps:
1. Open the attached project “ReproProj”
2. Go to File > Build Settings and choose iOS build target
3. Make sure that the build uses Xcode 15.x and press Build And Run
4. Wait for the build to finish
5. In the opened Xcode project, if needed, change Xcode scheme to “UnityFramework” and press the Build button
6. Go back to Editor and press CMD+B
7. Press the Build button in Xcode
8. Observe Xcode logs
Expected result: Xcode Build succeeds
Actual result: Xcode Build fails with “Unexpected duplicate tasks” error
Reproducible with: 2022.2.21f1, 2022.3.16f1, 2023.2.4f1, 2023.3.0b1
Not reproducible with: 2021.3.34f1, 2022.1.24f1, 2022.2.0a13
Couldn't test 2022.2.0a14 - 2022.2.20f1 (“BuildFailedException: Incremental Player build failed!”)
Reproducible on: macOS 14.2 (M1 Max), macOS 14.0 (Intel)
Not reproducible on: No other environment tested
Note: As a workaround, from the second time on, build the project from the Build Settings window using Build And Run and selecting the "Replace" option when prompted by macOS