Search code examples
xamarin.formsmaui

ways for white labelling in MAUI project?


I have project in Xamarin forms which we have to migrate to .NET MAUI we need White Labelling in that project like this White Labeling in Xamarin Forms Applications

e.g. in Xamarin.Forms I create configuration and define constant for that configuration in all projects (PCL, Android and iOS). then i give build action to info.plist and android manifest file that if at build time i choose any configuration it will pick that info.plist and android manifest file.

is there any way to do this? if No what other ways i can white label my application.

I tried this exact method but in MAUI it is picking default info.plist and android manifest file.


Solution

  • There's a lot of ways of white-labeling that I have used in my past that work well with maintaining little code, and with different CI/CD systems as well

    1. The one you shared from XamGirl where you create constants that can be used through Build configurations
    2. Using different GitHub branches for each white label brand. That way you can just pull the changes into each brand branch from the main/develop branch, and it works pretty well
    3. Shell Scripting is my personal favorite. I just published an article and recorded a video that you can access for free on how to use shell scripting for white labeling with MAUI applications.

    Shell Scripting

    I have explained it in a lot of details in my article, but in essence, in your MAUI app’s folder/directory create a new file brand1.sh with this:

    grep -rl 3071CF . | grep -v "brand1.sh" | xargs sed -i "" -e 's/3071CF/CE102C/g'
    grep -rl BeAware . | grep -v "brand1.sh" | grep -v ".git" | xargs sed -i "" -e 's/BeAware/Brand1/g'
    grep -rl com.tfp . | grep -v "Info.plist" | grep -v ".git" | grep -v "brand1.sh" | grep -v "MauiProgram" | grep -v "MainActivity" | grep -v "WebAuthenticatorActivity" | grep -v "AppDelegate" | grep -v "AccessTokenService" | grep -v "LoginPage" | xargs sed -i "" -e 's/com.tfp/com.brand1/g'
    cp -a brand1/. BeAware
    

    Create a new directory brand1, and put the images you want to replace in the right sub-directories/sub-folders using the same file name, format & dimensions. Then run the shell script using sh brand.sh!