Cordova Build Windows Error - Missing Microsoft.WinJS.2.0 Cordova Build Windows Error - Missing Microsoft.WinJS.2.0 windows windows

Cordova Build Windows Error - Missing Microsoft.WinJS.2.0


I had the same issue on an app that I'm working on. I am using Windows 10 and Visual Studio 2015. My app works fine on iOS / Android. When adding Windows as a platform, I tried:

cordova platform add windowscordova build windows

The build step failed with the same error as above:

error MSB3774: Could not find SDK "Microsoft.WinJS.2.0, Version=1.0". 

From Visual Studio, I opened the Solution file and noticed that there are 3 JS projects: one for Windows 8.1, Windows Phone 8.1 and Windows 10.0 Universal. Visual Studio could not run either of the 8.1 projects, even after I tried installing the 8.1 SDKs. However, it had no issue running the Windows 10 Universal project, which packaged its own version of WinJS not dependent on an SDK.

You can change Cordova to target Windows 10 by adding the following line to the config.xml

<preference name="windows-target-version" value="10.0" />

When you run via Cordova, it will install the app locally on your PC, which can be executed like any app from marketplace.


The HTML/JS-Apps part of the Windows (Phone) 8.1 SDK is missing. As described in this answer, you can install it as follows:

  • In Visual Studio, click "File" -> "New Project"
  • Select "Windows 8"
  • Double-click "Install Windows 8.1 and Windows Phone 8.0/8.1 tools"


What type of windows project are you trying to build? Windows Phone, Universal App, ...?

You can check the cordova.js script at line 1317 - there is a logic which identifies what WinJS script to load based on the navigator.appVersion. Set a break point there and walk through it..

Once I needed to change the appVersion in order to load the right script.

//Cordova code, line [1317]: if (!window.WinJS) {    var scriptElem = document.createElement("script");    if (navigator.appVersion.indexOf('MSAppHost/3.0') !== -1) {        // Windows 10 UWP        scriptElem.src = '/WinJS/js/base.js';    } else if (navigator.appVersion.indexOf("Windows Phone 8.1;") !== -1) {        // windows phone 8.1 + Mobile IE 11        scriptElem.src = "//Microsoft.Phone.WinJS.2.1/js/base.js";    } else if (navigator.appVersion.indexOf("MSAppHost/2.0;") !== -1) {        // windows 8.1 + IE 11        scriptElem.src = "//Microsoft.WinJS.2.0/js/base.js";    } else {        // windows 8.0 + IE 10        scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js";    }    scriptElem.addEventListener("load", onWinJSReady);    document.head.appendChild(scriptElem);}else {    onWinJSReady();}