Updating a Modern app in windows 8.
My name is Mayank sharma and I am a support engineer at Microsoft platforms division team. In this blog I will explain how you can update your modern apps meant for windows 8 and windows 8.1 machines that were side-loaded with the OS (also meaning that these apps are not installed from the windows store.)
In enterprise environment, administrators will typically sideload the company’s in-house apps on the standard image and then will deploy it to the windows devices. However with time the need for updating these side-loaded will app will arise; this blog walks you through about how this can be accomplished,
Before we start, it is suggested that one goes through the following article: http://technet.microsoft.com/en-US/windows/jj874388.aspx?ocid=wc-nl-insider this article talks about what are the requirements of sideloading an app and how you can side load your app on windows devices.
Imagining that you have now gone through this article, let’s get started…
In our scenario, we have a modern app (called as app1) which we will first sideload it into the windows 8.0 machine. The appx package of the app is placed in a shared folder (\\node2\temp, though you would not like keep your enterprise apps in a temp folder in real world!)
Step 1. We will first side load app1 in the windows base image by running following powershell command.
PS.Microsoft.PowerShell.Core\FileSystem::\\node2\temp\App1\App1\AppPackages\App1_126.96.36.199_AnyCPU_Debug_Test> dism /online /add-provisionedappxpackage /packagepath:App1_188.8.131.52_AnyCPU_Debug.appx /skiplicense
Remember, there is a difference between adding a package and ‘provisioning’ a package. While adding a package simply means that only the user who has added the package will be able to use it; provisioning means that the package has been provisioned in the windows image and it will be available for every user that will log in on the windows machine after the package is provisioned.
Step 2. You can check if the app is side loaded successfully by running
PS Microsoft.PowerShell.Core\FileSystem::\\node2\temp\App1\App1\AppPackages\App1_184.108.40.206_AnyCPU_Debug_Test> Get-AppxProvisionedPackage -online |Out-GridView
Here is the screenshot before and after the app was installed,
While after app1 was installed, you will see something like this, Look closely for the GUID and version of the new app.
To put this app on test I created two standard users in active directory named as test and test2. When we tried logging with for the first time, we will see app1 neatly on the start menu.
So everything looks in place, now let’s try to upgrade this app. But before we do that, please note that the modern apps runs in the user context once a user logs on. So here is the deal, If we want to update this app, we have to update it on per user basis, so we will now update the app. So user test logged in; we need to run the following on the server.
PS Microsoft.PowerShell.Core\FileSystem::\\10.162.100.12\package\App1_220.127.116.11_AnyCPU_Debug_Test> Add-AppxPackage -Path App1_18.104.22.168_AnyCPU_Debug.appx -DependencyPath Dependencies\Microsoft.WinJS.1.0.appx
Now if we list all the installed packages on the server, we will see the updated version of the app as shown below:
Ok, the test user is running an updated version of app now. What will happen if a new user test2 will log in? As mentioned earlier; the app runs in user context once the user the logs in; so when we updated a package using add-appxpackage; it only updated the version of app for user test and not for test2.
So to make this point, this is what we see once the user test2 logs in to the windows 8 device and we list get-appxpackage; we only see the original version of the app. As shown below.
Now to automate this process you may have to put add-appx package into the script either put it as a scheduled task or the use it as a logon script.
Thank you for reading the blog, I hope you will find it useful.