Skip to content

iOS Custom Entitlements File Not Respected #30221

@mitchelsellers

Description

@mitchelsellers

Description

Per the documentation, and VS tooling, you can manually set the path to an .plist file for the management of Entitlements for a MAUI application. However, the build process does not respect this setting and ALWAYS looks for Entitlements.plist within the solution

Steps to Reproduce

  1. Within the \Platforms\iOS\ folder add two .plist files. In my example, I had
  • Entitlements.plist which had an apn-environment of development
  • EntitlementsProduction.plstwhich had an apn-environment of 'production`
  1. Open the project properties
  2. Navigate to "iOS" -> "Bundle Signing"
  3. Within the "Custom Entitlements" option, navigate to your EntitlementsProduction.plist file

You will notice that Visual Studio automatically adds the following

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-ios|AnyCPU'">
	  <CodesignEntitlements>Platforms\iOS\EntitlementsProduction.plist</CodesignEntitlements>
	</PropertyGroup>

	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-ios|AnyCPU'">
	  <CodesignEntitlements>Platforms\iOS\EntitlementsProduction.plist</CodesignEntitlements>
		<UseInterpreter>true</UseInterpreter>
	</PropertyGroup>
  1. Now execute a build with a provisioning profile that requires the production apn-environment. (Any profile that is Ad Hoc or Distribution)

You will get a build error

error MT7137: The app requests the entitlement 'aps-environment' with the value 'development', but the provisioning profile 'REDACTED' grants it for the value 'production'

The expected behavior for this is that I would be using the PROPER provisioning profile, as configured in my project setting, not a magical setting of the default.

Link to public reproduction project repository

No response

Version with bug

9.0.0 GA

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

There is a manual workaround of pre-build and manual developer steps to modify the values of the publish profiles; however, this results in risks of misconfiguration and other related hindrances.

Relevant log output

Metadata

Metadata

Assignees

Labels

area-publishingIssues with the app packaging/publishing process (ipk/apk/msix/trimming)platform/ioss/needs-attentionIssue has more information and needs another lookt/bugSomething isn't working

Type

No type

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions