.NET MAUI iOS Publish throwing Missing Runtime Identifier error

Viewed 220

I'm trying to publish my .NET MAUI app using a Mac and I'm getting the following error:

A runtime identifier must be specified in order to publish this project

First, I'm not an experienced Mac user. Second, I'm on a remote rental Mac and I don't have Admin or Sudo privileges.

With that said, I tried to use the command from Microsoft docs but wasn't making any progress due to a few issues with the IP address of the Mac I'm renting, etc.

I then found a similar issue which suggested that I use:

dotnet publish -f:net6.0-ios -c:Release

Using this produced the error above. Someone suggested I add the runtime identifier to the command so I tried:

dotnet publish -f:net6.0-ios -c:Release -r ios-arm64

This gives me an error that indicates that ios-arm64 is not a valid identifier.

I then tried adding the following to the project file which is still not working and throwing the same error:

<PropertyGroup Condition="'$(IsPublishing)'  == 'true' And '$(TargetFramework)' == 'net6.0-ios'">
    <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
</PropertyGroup>

Any suggestions how I can publish this app? I'm just trying to create the bundle. I'll then upload it manually.

2 Answers

If your provisioning profile is correct, and you are using VS 2022, try to export the certificate (p12 file) in Keychain of your Mac and import the certificate and profile into VS.

Go to Keychain, click Login, click Certificates on the top bar, then select the certificate, right click it and export as a p12 file, pay attention to remembering the password.

Move the file to your Windows machine, go to Tools -> Options->Xamarin ->Apple Account in VS, and click View Details, click Import Certificate, import the p12 file and input the password.

Unfortunately, you need sudo in order to publish your MAUI app. I had this issue before and I solved it using sudo command.

I think this issue can be fixed in future VS2022 release or when MAUI officially release in coming November 2022.

Related