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).