Reputation: 9076
My Xamarin build tasks are failing in my Azure Dev Ops pipeline with:
error MSB4018: The "DetectSigningIdentity" task failed unexpectedly.
error MSB4018: System.ArgumentException: An item with the same key has already been added. Key: com.apple.developer.associated-domains
On opening the provisioning profile installed on the build agent I can indeed see that the com.apple.developer.associated-domains
key is included in the entitlements dictionary twice:
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>xxxxxxx</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>xxxxxxxx</string>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array>
<string>health-records</string>
</array>
<key>com.apple.developer.associated-domains</key>
<string>*</string>
<key>com.apple.developer.team-identifier</key>
<string>xxxxxxxxx</string>
<key>com.apple.developer.associated-domains</key>
<string>*</string>
</dict>
I edited the provisioning profile on the agent and removed the duplicate and disabled the install provisioning profile task and it works. However this manual workaround doesn't work for hosted build agents.
Any ideas why this is happening or how to fix? (I redacted sensitive stuff above with xxxxxxx).
Upvotes: 2
Views: 588
Reputation: 6044
It looks like this has been fixed on the Apple developer portal side. From my Enterprise account, I was able to generate development, ad-hoc, and in-house provisioning profiles with multiple capabilities and no duplicated keys.
I did not see an official notice from Apple on the topic, but I was able to create a release build and successfully deploy it to a device.
Upvotes: 2
Reputation: 19335
This is a bug in Xamarin.iOS which was surfaced by a change on Apple's side.
It's tracked here: https://github.com/xamarin/xamarin-macios/issues/5277
Upvotes: 1
Reputation: 242
+1 I'm also hitting this and can't release our app to the AppStore. The top of the stack trace looks like this:
"/Users/vsts/agent/2.144.0/work/1/s/Mobile/Mobile.iOS/Mobile.iOS.csproj" (Rebuild target) (1) ->
(_DetectSigningIdentity target) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(646,3): error MSB4018: The "DetectSigningIdentity" task failed unexpectedly. [/Users/vsts/agent/2.144.0/work/1/s/Mobile/Mobile.iOS/Mobile.iOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(646,3): error MSB4018: System.ArgumentException: An item with the same key has already been added. Key: aps-environment [/Users/vsts/agent/2.144.0/work/1/s/Mobile/Mobile.iOS/Mobile.iOS.csproj]
Upvotes: 0
Reputation: 754
Having the exact same problem. This just started occurring it appears on 12/12 or 12/13. Our mobile builds are dead in the water.
Either Xamarin will gracefully handle the duplicate now being caused by Apple or Apple resolves the regression and removes the duplicate.
Referencing:
https://forums.developer.apple.com/message/343811#343811
https://forums.xamarin.com/discussion/146770/the-detectsigningidentity-task-failed-unexpectedly
Possibly related (failure occurred at the same time as the Developer Portal update when the above problems began)
https://github.com/fastlane/fastlane/issues/13916
Upvotes: 1