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?

Gold.strike
  • 1,269
  • 13
  • 47
  • You could try to use build events to copy / replace the manifest files before the build – stefan.s Mar 30 '15 at 06:13
  • I'm looking how to apply this with using pre-build step. But I don't see how to solve the store association step: I need to associate the project on the store before to build it. I don't thing there is a way to do this.... – Gold.strike Mar 31 '15 at 13:34

1 Answers1

1

You can do this with the combination of a build configuration and a pre-build event.

  1. Create a build configuration for each customer, with their name
  2. Create a prebuild.bat file in your project directory that will copy the files for the correct customer to the project directory.
@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. Add a pre-build event like so:
    "$(ProjectDir)prebuild.bat" "$(ConfigurationName)" "$(ProjectDir)"

The batch file will copy the entire contents of the customer specific folder into your project, which can include the appxmanifest and xaml files. This assumes that all customer specific files are located in the folder customers/[name of customer] of the Windows Phone project.

Yves
  • 632
  • 1
  • 11
  • 17