Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin - Include Settings bundle in certain build configurations

I am currently building an iOS application using Xamarin and was looking to implement a settings bundle so that our QA department can point the app to the appropriate API environment.

What I am looking at doing is including or excluding the Settings bundle in the Xamarin iOS app based on the build configuration as I may not want to expose this data to the user in Release mode.

Can you include or exclude the Settings bundle or even change the bundle that is compiled into the app based on the build configuration?

like image 909
Phil Murray Avatar asked Dec 24 '22 06:12

Phil Murray


1 Answers

(I gotten asked this so many times :-) , I figured I would expand my original answer.)

So as an example, in Debug mode, I want to include a Setting.bundle that consists of Root.plist and a submenu Extra.plist.

In Release mode, I want to include a totally different Root.plist and no Extra.plist in the app's Setting.bundle

My .csproj file is going to look like this:


  <ItemGroup Condition="'$(Configuration)'!='Debug'">
    <BundleResource Include="Settings.bundle\Root.plist" >
    </BundleResource>
  </ItemGroup>
  <ItemGroup Condition="'$(Configuration)'=='Debug'">
    <BundleResource Include="Settings.debug\Extra.plist" >
            <Link>Settings.bundle\Extra.plist</Link>
    </BundleResource>
    <BundleResource Include="Settings.debug\Root.plist" >
            <Link>Settings.bundle\Root.plist</Link>
    </BundleResource>
  </ItemGroup>

Note:

As shown below, in Debug Xamarin is including additional menu items into my Root.plist and in Release they are not. Also my Additional Settings submenu is no longer available and now are labeled with XXXX Release

Debug mode result:

enter image description here

enter image description here

Release mode result:

enter image description here

like image 91
SushiHangover Avatar answered Dec 28 '22 09:12

SushiHangover