Fixing: Could not find any available provisioning profiles for your MAUI app


Scenario
Imagine buying a new MacBook and installing / configuring all the prerequisites to build your MAUI app:
Install latest
.NET SDK
(https://dotnet.microsoft.com/en-us/download)- Run
sudo dotnet workload install maui-mobile
- Run
Install latest
XCode
(can be found at xcodereleases.com)Within
XCode > Settings > Components
, install theiOS
simulator package for the correspondingXCode
version (i.e.XCode = 16.2
matchesiOS 18.2
)From
XCode > Settings > Account
log in into your accountUsing
XCode
create a stub app with the same app identifier of the MAUI app- Ensure automatic provisioning is selected and you can build and deploy your app to simulator
Now opening your MAUI project and trying to build&deploy to the iOS simulator will generate this error:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_17.5/17.5.8030/tools/msbuild/iOS/Xamarin.Shared.targets(1834,3):
error : Could not find any available provisioning profiles for MyCompany.MyApp on iOS. [/Users/myuser/my-app-repo/MyCompany.MyApp/MyCompany.MyAppcsproj::TargetFramework=net9.0-ios]
The problem
The main issue is that the build looks into ~/Library/MobileDevice/Provisioning Profiles/
folder which is empty, but it wasn’t so using older XCode
versions.
Starting from version 15.x
, XCode
is no longer storing provisioning profiles on disk: they’re being stored in memory as long as they serve their purpose in building the app.
How to fix the build
Fortunately, if you push the XCode > Settings > Account > Download Manual Profiles
button, all the provisioning profiles will be stored in ~/Library/Developer/Xcode/UserData/Provisioning Profiles/
folder.
Also make sure you can run a stub app with the same bundle identifier from XCode.
Now we can simply copy the content where dotnet build
expects to see the profiles.
cp -f ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles/*.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
That’s it: this will solve the main issue and dotnet build
will now find all of the available provisioning profiles.
Remember to do this every time you need a new provisioning profile.
Subscribe to my newsletter
Read articles from Alberto Aldegheri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
