Upgrading WinJS 2.0 to WinJS 4.4

image

I’m working on upgrading an app from the STY Windows 8 Apps with JavaScript and HTML5 book I wrote several years back. So my first task was upgrading it from a Windows 8 app to a Windows 10 Universal app.  Making an app once and having it run across lots of devices is a great thing.

In Visual Studio, which is what you would have used for a WinJS 2.0 application, you can download WinJS 4.4 from NuGet. WinJS is actually also available as a bower, grunt or npm package. As of WinJS 3.0, it went cross platform and is no longer tied to only Windows development. You can use WinJS on your websites for example.

http://try.buildwinjs.com/download/GetWinJS/

To get started, create a new Windows Universal App using JavaScript and then copy over your existing files from your original WinJS 2.0 project.

My default page was called default.html, but the new solution created an index.html page. If you have the same scenario, open up the package.appxmanifest in Visual Studio (to get a nice GUI) or via code to edit it directly and under the general application tab you will see Start Page as index.html. Change that to default.html and delete index.html.

In your pages that reference WinJS, for example the default.html or index.html, change //Microsoft.WinJS.2.0/ to /WinJS/ . By downloading WinJS through NuGet, it put the WinJS folder in your application.

Hopefully this will get you started on your way to upgrade your Windows 8 WinJS apps to Windows 10 Universal apps.

One last thing I’ll mention is that the package manifest has changed. You can see what has changed in Microsoft’s documentation here:

https://msdn.microsoft.com/library/windows/apps/dn705793.aspx

Have fun upgrading your WinJS apps!

Tell me what you think!