3

I developped a Universal App for Windows 8.1/Windows Phone 8.1.

This application must be proposed by default to the main customers, but other clients must be able to customize it by giving their own name, their own assets (icons, splashscreen, ...) and their own UI colors. I look for a solution allowing me to do this.

I thus thought to create multiple files "appxmanifest":

  • the default one "Package.appxmanifest"
  • and one per customer "Customer1.appxmanifest", "Customer2.appxmanifest", ...

=> But I don't know how to specify a different "appxmanifest" to use at compilation: is it possible?

In addition, the UI colors are defined in a xaml file, which is merged with the "App.xaml" file using "MergedDictionaries".

=> Is there a way to do this?

4

1 回答 1

1

您可以结合构建配置预构建事件来完成此操作。

  1. 用他们的名字为每个客户创建一个构建配置
  2. 在您的项目目录中创建一个 prebuild.bat 文件,该文件会将正确客户的文件复制到项目目录中。
@setlocal enableextensions enabledelayedexpansion  
@echo off  
set buildconfig=%1  
set projectdir=%~2  

if %buildconfig% == "Customer1" goto CopyCustomerFiles  
if %buildconfig% == "Customer2" goto CopyCustomerFiles  
goto End 

:CopyCustomerFiles   
xcopy "%projectdir%\customers\%buildconfig%" "%projectdir%" /I/Y/R/S  
goto End

:End  
endlocal  
  1. 添加一个预构建事件,如下所示:
    "$(ProjectDir)prebuild.bat" "$(ConfigurationName)" "$(ProjectDir)"

批处理文件会将客户特定文件夹的全部内容复制到您的项目中,其中可能包括 appxmanifest 和 xaml 文件。这假定所有客户特定文件都位于 Windows Phone 项目的文件夹 customers/[客户名称] 中。

于 2015-04-03T17:21:55.877 回答