:::: MENU ::::

Upgrading windows 8.1 app to windows 10

Universal Windows Platform (UWP) is awesome. Developing single binary and deploying in any windows-powered device is really awesome. And another most awesome thing is you can even upgrade your existing windows/phone application to windows 10 (UWP) app. Here I will share how to upgrade windows 8.1 app to windows 10. I have a very simple windows 8.1 app (available in store) and I want to upgrade it. These are the steps I followed.

Steps:

  • Open your project on VS 2015
  • From solution explorer go to project location

  • Run command prompt in that folder

  • Download this power shell script  from git hub and unzip it. This scripts contains all the code that we have to add and update in our existing windows 8.1 app to make it Win10 app. You can see complete script in power shell editor.(Right click and edit the .ps file)

  • There is bat file in the folder where you unzip files from git hub earlier and now you have to run that bat file in command prompt where you open earlier in project location

  • Now It’s done. Technically your windows 8.1 app is now Win10 app. Here is proof. 😀

  • Once you reload (Reload All) your project and build it then you may (will) get list of errors. So now lets look to them

My simple app has not used much API so I got less error. Quantity of error depends on how much API (of SDK) you used in your app. So lets see some of the error and there solutions of my project:

  • If you get error in namespace or device specific API like hardware back button pressed event which is used for phone only there you have to use mobile extension SDK (you can add from add extension section by doing add reference) and put adaptive code around this like
  • Change the processor architecture to x86

  • You may some time get error in appxmanifest file in <mp:PhoneIdentity> section if you got one, then change the PhoneProductId to “000-00..” as like of PhonePublisherId.
  • Other API like file picker also cause error. Methods like PickSingleFileAndContinue() of file picker is now gone. So Now you have to remove all suspend and reactivation code which is now handle by single method PickSingleFileAsync().
  • Not only in .cs file, Xaml file also have error. Like if you used PhoneAccentBrush (ThemeResource of WP) for controlling colors then its not working here and you have to create your own resource to replace that resource (or could be existing phone specific style too).
  • If your app is of multiple pages then you have to handle back press event. As I mention in no. 1 of Problems/Solutions you can handle back press event by subscribing BackRequested event for both desktop and mobile version. In mobile backpress is usually done by hardware back button but in desktop version either you have to written your own custom control for back button or you can take benefit of shell back button. To enable shell back button do this in App.xaml.cs after current window is activated.

There could be more errors and it depends on how much API (of SDK) you used in your app. This is the way how you debug and fix it.

After you fix all error build it and run it hope your app run well. Here is mine.

 

That’s it.

Happy coding 🙂