UWP / Visual Studio:如何制作不同的构建版本? [英] UWP / Visual Studio: How to make different builds variants?

查看:79
本文介绍了UWP / Visual Studio:如何制作不同的构建版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要可以并行安装UWP应用程序的三种不同的构建变体(风味):一种用于生产,一种用于测试,一种用于开发。他们显然需要共享相同的代码库,但是具有不同的常量,例如后端URL和API密钥。

I need to have three different build variants (flavors) of my UWP app that can be installed parallel: one for production, one for testing and one for development. They obviously need to share the same code base but have different constants like backend URLs and API keys.

在Android Studio中,这可以使用构建变体和Xcode来完成。这可以使用方案来完成。什么是Visual Studio等效项?

In Android Studio this can be done using "build variants" and in Xcode this can be done using "schemes". What's the Visual Studio equivalent of those?

也许像 https://msdn.microsoft.com/zh-cn/library/kwybya3w.aspx 是一种方法。默认情况下,我具有Debug和Release配置。将它们重命名为Production-Debug和Production-Release,然后创建Testing-Debug,Testing-Release,Development-Debug和Development-Release,是否正确?但是我不明白的是:

Maybe "build configurations" using the Configuration Manager as in https://msdn.microsoft.com/en-us/library/kwybya3w.aspx is the way to go. By default I have a Debug and a Release configuration. Would it be correct to rename those to Production-Debug and Production-Release and then create Testing-Debug, Testing-Release, Development-Debug and Development-Release? What I don't understand though:


  1. 是否可以让我在同一设备上并行安装生产,测试和开发?

  2. 我怎么知道我在代码中运行哪种样式(为了获得不同的属性,常量)?

编辑:这是关于UWP应用程序,而不是Web应用程序。

This is about UWP apps, not about web apps.

推荐答案

您可以只使用如下条件:

You can just use conditionals like this:

<AppxManifest Include="Manifest.Debug.xml"
              Condition="'$(Configuration)'=='Debug'">
  <SubType>Designer</SubType>
</AppxManifest>
<AppxManifest Include="Package.appxmanifest"
              Condition="'$(Configuration)'=='Release'">
  <SubType>Designer</SubType>
</AppxManifest>

这篇关于UWP / Visual Studio:如何制作不同的构建版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆