Archive | March, 2017

Development, test and production UWP apps running side-by-side

14 Mar

We often have the need for having both development, test and production version of UWP apps installed on our development and test machines. To accomplish this we modify the package.appxmanifest as part of the build and release process in VSTS.

The “Name”-attribute in the “Identity”-tag in the manifest file determine the unique identification of the app. This is what needs to be different in development, test and production.

Step 1 – associate app with Windows Store

Before doing any modifications, it can be a good idea to associate your app with the Windows Store. You’ll need the info generated later.

Step 2 – development

For development use you can set the value directly from Visual Studio (open package.appxmanifest in code view).

You can set the value of the “Name”-attribute in the “Identity”-tag to actually what you want. Copy and save the existing value – you’ll need this info in a bit.

You can set the “DisplayName”-attribute in “uap:VisualElements”-tag to a clear development name – I often add “(dev)” after the existing value.

Step 3 – test

For test, the modifications to the package.appxmanifest file should happen as part of the build process (in VSTS).

To make the modifications I use two powershell scripts – one for the identity name (SetPackageName.ps1) and one for the displayname (SetDisplayName.ps1). Add the scripts to your files (eg. in a resources-folder) and commit them.

Edit your build definition and add two powershell script tasks – add them before the build task.

Point the first task to the SetPackageName script. Set the new package name as argument to the script: “-packagename ‘MyAwesomeAppTest’”. Set the working folder to the folder where the package.appxmanifest is under the “Advanced”-section.

Point the second task to the SetDisplayName script. Set the new display name as argument to the script: “-displayname ‘My Awesome App (test)’”. Set the working folder to the folder where the package.appxmanifest is under the “Advanced”-section.

Step 4 – production

For production it is the exact same steps as for test. For production you should use the values you initially changed in the package.appxmanifest file.

Wrap up

You should now be able to install development, test and production versions of your app, without the apps interfering with each other.

// thomas