2

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

Magic Bullet Dave
  • 9,006
  • 10
  • 51
  • 81

4 Answers4

2

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.

Paul Walls
  • 5,884
  • 2
  • 22
  • 23
1

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

Craig Johnson
  • 744
  • 4
  • 8
1

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

Rolf Bjarne Kvinge
  • 19,253
  • 2
  • 42
  • 86
  • This just started happening to me -- some 4 years after this post. I'm running the latest version of Xamarin Forms 5 on Visual Studio 2022. Still researching how to fix it so any pointers would be appreciated. – Sam Apr 01 '22 at 16:59
0

+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]

tyjen
  • 242
  • 4
  • 7