Maui - pre build targets iOS
I have a Maui app. It’s a white label application that will have many brand styles applied to it.
To do this I am running a target in the csproj to copy images and files around pre build
For example like this. This is an example of it.
<Target Name="CopyData" BeforeTargets="PrepareForBuild”> <Exec Command="cp -f ../SharedBrandData/$(BrandName)/Images/logo.svg Resources/Images/logo.svg" /> </Target> This is working perfectly on Android but PrepareForBuild doesn’t exist on iOS. None of the BeforeTargets I’ve found on iOS do the same thing. They all seem to run after the resizetizer. I need to copy images before this runs. Has anyone managed to do this on iOS?
<Target Name="CopyData" BeforeTargets="PrepareForBuild”> <Exec Command="cp -f ../SharedBrandData/$(BrandName)/Images/logo.svg Resources/Images/logo.svg" /> </Target> This is working perfectly on Android but PrepareForBuild doesn’t exist on iOS. None of the BeforeTargets I’ve found on iOS do the same thing. They all seem to run after the resizetizer. I need to copy images before this runs. Has anyone managed to do this on iOS?
1 Reply
After a couple of days of messing with this I have an answer
these 2 will run at roughly the same time in the build process and will be before the resizertizer so files moved are processed as expected.
<Target Name="CopyBrandingiOS" BeforeTargets="ProcessMauiSplashScreens" Condition="$(TargetFramework.Contains('ios'))">
</Target>
<Target Name="CopyBrandingAndroid" BeforeTargets="PrepareForBuild" Condition="$(TargetFramework.Contains('android'))">
</Target>