Sorry for the late reply. You likely need to add some additional settings to your .csproj or to the respective .props files, to target the correct platform configuration for releases, such as
<PropertyGroup>
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
However, I would recommend doing these things in a build pipeline instead of building a release locally. I was planning to write a follow up on this, but didn't find the time yet.
Great article ! How do you target different Platform Configurations for these clients ( AndroidManifest , info.plist) ? Can you add to this blog ?
Never mind :) Asked ChatGpt and here is the question & the result ...
Question: using the above result, please change assuming there are also 2 additional configurations "Chus-DEV" and "Chus-Release" and also that the Resources contain another folder called Images which might have multiple images for that configuration that need to be copied to a folder under Resources named "Images"
Certainly! Here's how you can update the .csproj file to handle the additional configurations "Chus-DEV" and "Chus-Release", and also copy the images from the respective configuration-specific folders to the Resources/Images directory.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
<!-- Add other properties here -->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<AndroidManifestFile>Platforms/Android/Debug/AndroidManifest.xml</AndroidManifestFile>
<IpaPackageInfoFile>Platforms/iOS/Debug/Info.plist</IpaPackageInfoFile>
<ImagesSourceFolder>Resources/Debug/Images</ImagesSourceFolder>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<AndroidManifestFile>Platforms/Android/Release/AndroidManifest.xml</AndroidManifestFile>
<IpaPackageInfoFile>Platforms/iOS/Release/Info.plist</IpaPackageInfoFile>
<ImagesSourceFolder>Resources/Release/Images</ImagesSourceFolder>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Chus-DEV'">
<AndroidManifestFile>Platforms/Android/Chus-DEV/AndroidManifest.xml</AndroidManifestFile>
<IpaPackageInfoFile>Platforms/iOS/Chus-DEV/Info.plist</IpaPackageInfoFile>
<ImagesSourceFolder>Resources/Chus-DEV/Images</ImagesSourceFolder>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Chus-Release'">
<AndroidManifestFile>Platforms/Android/Chus-Release/AndroidManifest.xml</AndroidManifestFile>
<IpaPackageInfoFile>Platforms/iOS/Chus-Release/Info.plist</IpaPackageInfoFile>
<ImagesSourceFolder>Resources/Chus-Release/Images</ImagesSourceFolder>
</PropertyGroup>
<ItemGroup>
<!-- Include other files, references, etc. -->
</ItemGroup>
<!-- Copy Android Manifest file -->
<Target Name="CopyAndroidManifest" BeforeTargets="Compile;Build">
<Copy SourceFiles="$(AndroidManifestFile)" DestinationFiles="Platforms/Android/AndroidManifest.xml" />
</Target>
<!-- Copy Info.plist file -->
<Target Name="CopyiOSPlist" BeforeTargets="Compile;Build">
<Copy SourceFiles="$(IpaPackageInfoFile)" DestinationFiles="Platforms/iOS/Info.plist" />
</Target>
<!-- Copy Images -->
<Target Name="CopyImages" BeforeTargets="Compile;Build">
<ItemGroup>
<ImageFiles Include="$(ImagesSourceFolder)/*.*" />
</ItemGroup>
<Copy SourceFiles="@(ImageFiles)" DestinationFolder="Resources/Images/" SkipUnchangedFiles="true" />
</Target>
</Project>
PropertyGroup: Each configuration (Debug, Release, Chus-DEV, Chus-Release) defines its own paths for the AndroidManifest.xml, Info.plist, and ImagesSourceFolder.
Target - CopyAndroidManifest: Copies the AndroidManifest.xml file to the Platforms/Android/ directory.
Target - CopyiOSPlist: Copies the Info.plist file to the Platforms/iOS/ directory.
Target - CopyImages: Copies all files from the configuration-specific images folder ($(ImagesSourceFolder)) to the Resources/Images/ directory, using the SkipUnchangedFiles attribute to avoid unnecessary copying.
This setup ensures that the correct manifest and plist files are used for each build configuration, and that the appropriate images are copied to the Resources/Images/ directory.

Andre Bacaglini
Hi! Did the publish/archive action work well with these modifications? I`m trying to create a Release using Release-ClientA, and the final aab file seems to stay in "debug".