0
votes

In my Visual Studio Xamarin Forms project, I created a new run-time configuration (AppName.ios - DevBuild). I now have two configurations, one is the default (AppName.iOS) and another one is the Custom Configuration (AppName.iOS - DevBuild). Based on the run-time configuration, I want to display a page. How do I do that?

For example: Let us take two pages named Page A and Page B. If the project is built using AppName.iOS-DevBuild, then Page A should be the MainPage. If not, then Page B should be the MainPage.

1
What is two run time configuration? Are there two info.plists in your iOS project? - Jack Hua
you can define compiler flags on a per-config basis, and use #IFDEF checks in your code to conditionally execute based on those flags - Jason
@JackHua-MSFT : No, there is just one info.plists - deanwin3390
@Jason : is there any example you can share ?? - deanwin3390
I still don't know how do you config your Run-Time Configuration? Show us some relevant code? Or you want a way to do Run-Time Configuration? - Jack Hua

1 Answers

0
votes

in the project options dialog, under Compiler, in the "Define Symbols" box, add a symbol "MySymbolName". This can be done per-configuration

then in your code

#if MySymbolName
  // any code in this block will only be compiled in configurations where
  // MySymbolName is defined
#endif