Unable to publish iOS with Rider - PublishTrimmed must be true
I'm beside myself here. I've got 2 MAUI apps (both support iOS and Android) that I need to release updated versions for, but I keep running into the error here:
Xamarin.Shared.Sdk.targets(285,3): Error : iOS projects must build with PublishTrimmed=true. Current value: false. Set 'MtouchLink=None' instead to disable trimming for all assemblies
In my .csproj I have <PublishTrimmed>true</PublishTrimmed> declared in the initial Property Group (that also has target framworks, app id, etc). I've read the MS documents on trimming. Prior versions of the apps were published via VS for Mac, .Net 7 framework, but for some reason I decided to move to .Net 8.0 and give Rider a try. Love Rider, well work paying for, but I'm in a corner now with VS Mac not supporting .Net 8, and trying to run VS on a Windows 11 VM and connecting back to my host MacOS, is cumbersome at best. I know the trimming thing is not a Rider issue. For the life of me I cannot find any resolution for this.
Any help or guidance would be greatly appreciated. Thanks,
Kurt Mackall - Silver Ridge Software LLC
Please sign in to leave a comment.
Hello Kmackall ,
Thank you for reaching the Rider forum.
Can you please provide me with a sample solution to reproduce the issue? You may want to upload it to our shared storage at https://uploads.jetbrains.com and send the ID of the upload.
Thank you in advance.
I am having the exact same issue described by Kurt above and arrived here by almost identical means.
Error message:
Here is my .csproj file:
After saving changes to my .csproj file, I have tried:
Here is what my Publish Config looks like in Rider:
My .csproj file looks similar to what Adam posted. I cannot upload any files even to a secure site as the project is a commercial application. I also went through the steps Adam outlined (probably multiple times probably).
My workaround to get a build to publish, was to open the MAUI project in Visual Studio 2022 in my Windows 11 Parallels VM. There, I made sure the distribution signing certificate and the publishing profile were correct from what I put into the project file in Rider, and then in VS Windows I was able to build and publish the MAUI project without a problem. So thinking that maybe VS Windows made a change to the .csproj file or project properties that Rider would find useful, I then went back to Rider Mac and tried to publish the project, and I got the same error as above. Going back to Win 11 VS 22, I opened the MAUI app back up and successfully published the project.
I'm having the same issue but with a .net-ios project using .Net8.0 framework.
Hello Kmackall ,
Thank you for the update.
I tried reproducing the issue with the similar
.csproj, but met no error publishing. Thus, is it possible to provide me with the following details?ismart @Adam,
Is it possible for you to provide the same information and, if possible, a test solution to reproduce the issue?
Thank you in advance. Looking forward to your reply.
Anna Morozyuk
Sterilized Solution file: 2024_01_25_uonb8LwZh7gU7wGNX9kRch
Hello,
Thank you for the patience.
From all the provided information, it seems that you've been affected by the consequences of this issue:
RIDER-76797 Archive for publish doesn't work for MAUI projects
And thus, once it is implemented, all should work just fine. At the moment, it is planned to be included in the next major release of Rider. Please upvote it or follow to get updates on the progress.
Thank you and have a nice day.
<OutputType>Exe</OutputType> removing this worked for me
Annoying and inexplicable but Sonny S's OutputType removal worked for me to resolve this.