MSB6006 codesign exited with code

I've developed a mobile app in Visual Studio 2022 on Windows 11 on the MAUI platform. I'm Pair to a remote Mac machine to test/debug on an iOS Simulator. I was previously able to test on the remote mac machine simulator with not problems. I added some features including Geolocation and now I get the following error:

error MSB6006: "codesign" exited with code 3.

These are the last few lines in the Output window:

1> [xma][info]: Starting remote task execution for 'TriStar.Mobile.DriverPortal': Xamarin.MacDev.Tasks.CodesignVerify

1> [xma][info]: Sending Request Xamarin.Messaging.Build.Contracts.ExecuteTaskMessage to topic xvs/build/17.2.8053/execute-task/TriStar.Mobile.DriverPortal/8f2f6e4002fCodesignVerify 1> [xma][info]: Received Response of Xamarin.Messaging.Build.Contracts.ExecuteTaskMessage to topic build2424827232benbl/+/xvs/build/17.2.8053/execute-task/TriStar.Mobile.DriverPortal/8f2f6e4002fCodesignVerify 1> CodesignVerify: 2024-05-31T17:36:08.1417751-05:00 - Logging messages 1> Environment Variables passed to tool: 1> CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate 1> /usr/bin/codesign --verify -vvvv "-R=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)" bin/Debug/net8.0-ios/iossimulator-arm64//TriStar.Mobile.DriverPortal.app 1> bin/Debug/net8.0-ios/iossimulator-arm64//TriStar.Mobile.DriverPortal.app: valid on disk 1> bin/Debug/net8.0-ios/iossimulator-arm64//TriStar.Mobile.DriverPortal.app: satisfies its Designated Requirement 1> test-requirement: code failed to satisfy specified code requirement(s) 1> C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8053\tools\msbuild\iOS\Xamarin.Shared.targets(2059,3): error MSB6006: "codesign" exited with code 3.

Is there a problem or conflict with my entitlements?

<dict>
      <key>com.apple.security.app-sandbox</key>
      <true/>
      <key>com.apple.security.network.client</key>
      <true/>
</dict>

The remote Mac is a Mac-In-Cloud running xCode 15.3 and Visual Studio 2022. My dev machine is running Windows 11 and VS 2022

In my Windows VS MAUI project I have

  <PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios'">
    <EnableCodeSigning>true</EnableCodeSigning>
    <CodesignKey>Apple Development: BENJAMIN BLA... (7AGK....)</CodesignKey>
    <ProvisioningType>automatic</ProvisioningType>
    <CodesignProvision>VS: com.tristarfreightsys.driverportal Development</CodesignProvision>
  </PropertyGroup>

VS: com.tristarfreightsys.driverportal Development is the Provisioning Profile automatically generated by VS.

My Development Certiifcate and Distrubution Cert are in the Mac Keychain and in my VS

Answered by BenBlanco in 793135022

Excllent! Change EnableCodeSigning from true to false. and removed the unnecessary entitlements and that worked. Thanks!!

It’s hard to explain the root cause of this because it’s tied to your third-party tooling. However, you can see the immediate cause in this log message:

/usr/bin/codesign --verify -vvvv "-R=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)" …/TriStar.Mobile.DriverPortal.app
…/TriStar.Mobile.DriverPortal.app: valid on disk
…/TriStar.Mobile.DriverPortal.app: satisfies its Designated Requirement
test-requirement: code failed to satisfy specified code requirement(s)

Your build system has run a codesign with the --verify argument, causing it to verify the code signature for TriStar.Mobile.DriverPortal.app. That’s failing. The code satisfies its DR but fails to satisfy the explicit requirement passed in by your build system.

Note You can learn more about code signing requirements in TN3127 Inside Code Signing: Requirements.

I’ve no idea why your build system is trying to verify the code it (presumably) just signed, nor why it’s passing in an explicit requirement. The latter is particularly mysterious because code signing requirements are, in general, a macOS thing, and rarely relevant on iOS.

Is there a problem or conflict with my entitlements?

Again, it’s hard to say without having deep knowledge of your third-party tooling, but both of the entitlements you listed (com.apple.security.app-sandbox and com.apple.security.network.client) are macOS entitlements that aren’t relevant to, and must not be claimed by, iOS apps.


Taking a step back, I think you’d might have more luck asking for help via the support channel for the third-party tools you’re using.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Excllent! Change EnableCodeSigning from true to false. and removed the unnecessary entitlements and that worked. Thanks!!

MSB6006 codesign exited with code
 
 
Q