Xamarin - 在某些构建配置中包含设置包 [英] Xamarin - Include Settings bundle in certain build configurations
问题描述
我目前正在使用Xamarin构建iOS应用程序,并且正在寻求实现设置包,以便我们的QA部门可以将应用程序指向适当的API环境。
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.
我正在做的是基于构建配置在Xamarin iOS应用程序中包含或排除Settings包,因为我可能不希望在发布模式下将此数据公开给用户。
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?
推荐答案
(我多次问过这个问题:-),我想我会扩展原来的答案。)
(I gotten asked this so many times :-) , I figured I would expand my original answer.)
举个例子,在 Debug
模式,我想要包含 Setting.bundle
,其中包含 Root.plist
和子菜单 Extra.plist
。
So as an example, in Debug
mode, I want to include a Setting.bundle
that consists of Root.plist
and a submenu Extra.plist
.
在发布
模式,我想要包含一个完全不同的 Root.plist
在应用的 Setting.bundle
In Release
mode, I want to include a totally different Root.plist
and no Extra.plist
in the app's Setting.bundle
<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>
注:
如下所示,在 Debug
Xamarin将其他菜单项包含在我的Root.plist和 Release $ c中$ c>他们不是。此外,我的
其他设置
子菜单不再可用,现在标有 XXXX Release
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
这篇关于Xamarin - 在某些构建配置中包含设置包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!