Windows 10 SDK missing


#1

Hi, I just wanted to compile my ionic app for windows 10.
So I typed ionic cordova build windows.
And I get this:

(node:1284) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Windows SDK not found. Ensure that you have installed Windows 8.1 SDK along with Visual Studio or install Windows 8.1 SDK separately from https://dev.windows.com/en-us/downloads

The Problem: I did install the Windows SDK. Is it a problem, that I installed the Windows 10 SDK instead of the 8.1? What shall I do?


#2

What is your ionic info output?
What does ionic cordova requirements return?

(I just ran the release for the latest cordova-windows, so I should be able to help you)


#3

Hi, thanks for your answer!
The output of ionic info is

cli packages: (C:\Users\Lukas\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v6.11.5
    npm  : 3.10.10
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

The output of ionic cordova requirements is:

Requirements check results for windows:

Windows OS: installed Windows 10
MSBuild Tools: installed 14.0
Visual Studio: not installed
Required version of Visual Studio not found. Please install Visual Studio 2013 Express for Windows Update2 from https://www.visualstudio.com/downloads/download-visual-studio-vs
Windows SDK: not installed
Windows SDK not found. Ensure that you have installed Windows 8.1 SDK along with Visual Studio or install Windows 8.1 SDK separately from https://dev.windows.com/en-us/downloads
Windows Phone SDK: not installed
Windows Phone SDK not found. Ensure that you have installed Windows Phone 8.1 SDK along with Visual Studio or install Windows Phone 8.1 SDK separately from https://dev.windows.com/develop/download-phone-sdk
(node:11960) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Some of requirements check failed

Here it says that the Windows SDK is not installed. But I did install it! Is there any environment variable to set maybe?


#4

Ugh, hitting a bug here :wink:

What does ionic cordova platform list output?

You will have the best chance to succeed with the 6.0.0 release of cordova-windows:
https://cordova.apache.org/announcements/2018/02/27/cordova-windows-6.0.0.html
It is not installed by default, so you will have to specify the version when installing (see the blog post).


#5

The output of ionic cordova platform list is:

> cordova platform ls
Installed platforms:
  windows 5.0.0
Available platforms:
  android ~7.0.0
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  www ^3.12.0

I will read the blog post!


#6

I added the platform now and builded it withcordova build windows. I still get an error.

Building project: C:\Users\Lukas\Desktop\Schulapp\Schulapp\platforms\windows\CordovaApp.Windows10.jsproj
        Configuration : debug
        Platform      : anycpu
        Buildflags    : /p:AppxBundle=Never
        MSBuildTools  : C:\Program Files (x86)\MSBuild\14.0\bin
buildProject spawn: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild [ 'C:\\Users\\Lukas\\Desktop\\Schulapp\\Schulapp\\platforms\\windows\\CordovaApp.Windows10.jsproj',
  '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
  '/nologo',
  '/p:Configuration=debug',
  '/p:Platform=anycpu',
  '/p:AppxBundle=Never' ] { stdio: 'inherit' }
C:\Users\Lukas\Desktop\Schulapp\Schulapp\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: Das importierte Projekt "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Micr
osoft.VisualStudio..Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.
(node:9196) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): code: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1 No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1

#7

Ugh, that is unexpected.

Can you post your ionic info and cordova platform list again please, just to make sure.

Can you share line 61 of that file please?

What Visual Studio have you installed?


#9

Line 61:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
ionic info:

cli packages: (C:\Users\Lukas\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : windows 6.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v6.11.5
    npm  : 3.10.10
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

cordova platform list:

Installed platforms:
  windows 6.0.0
Available platforms:
  android ~7.0.0
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  www ^3.12.0

I have installed both Visual Studio Professional 2017 and Visual Studio Community 2017.


#10

See the error message:

vs. the actual line:

Not that $(WMSJSProject) is not being replaced, which should not happen.

Please open a command line and do this:

cd %ProgramFiles(x86)%\Microsoft Visual Studio\Installer
vswhere -legacy -property installationPath

Somehow the MSBuild it is choosing for you doesn’t work. The code doing the selecting is a piece of crap, but maybe we can fix that manually.


#12

Thank you for your help so far!
The output of the command is:

C:\Program Files (x86)\Microsoft Visual Studio\Installer>vswhere -legacy -property installationPath
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community

#13

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin exists? If so, set the env var MSBUILDDIR to that value and then try again.

(The selection mechanism might be confused by having both Enterprise and Community at the same time - I never tested this and I assume it is not a very common setup. Is it?)


#14

No it might not be :smiley: I first installed the community version because its free and then I got the professional version for free and installed it too. So now I got both.
I set the system variable to that value (the directory exists). There has not even been a variable called MSBUILDDIR before.
The error is still thrown :frowning:

C:\Users\Lukas\Desktop\Schulapp\Schulapp>ionic cordova build windows
Running app-scripts build: --platform windows --target cordova
[20:46:51]  build dev started ...
[20:46:51]  clean started ...
[20:46:51]  clean finished in 9 ms
[20:46:51]  copy started ...
[20:46:51]  deeplinks started ...
[20:46:52]  deeplinks finished in 38 ms
[20:46:52]  transpile started ...
[20:46:59]  transpile finished in 7.83 s
[20:46:59]  preprocess started ...
[20:46:59]  preprocess finished in 79 ms
[20:47:00]  webpack started ...
[20:47:01]  copy finished in 9.13 s
[20:47:22]  webpack finished in 21.94 s
[20:47:22]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:47:24]  sass finished in 2.07 s
[20:47:24]  postprocess started ...
[20:47:24]  postprocess finished in 30 ms
[20:47:24]  lint started ...
[20:47:24]  build dev finished in 32.49 s
> cordova build windows
[20:47:29]  lint finished in 5.73 s
Building project: C:\Users\Lukas\Desktop\Schulapp\Schulapp\platforms\windows\CordovaApp.Windows10.jsproj

        Configuration : debug
        Platform      : anycpu
        Buildflags    : /p:AppxBundle=Never
        MSBuildTools  : C:\Program Files (x86)\MSBuild\14.0\bin
buildProject spawn: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild [ 'C:\\Users\\Lukas\\Desktop\\Schulapp\\Schulapp\\platforms\\windows\\CordovaApp.Windows10.jsproj',
  '/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
  '/nologo',
  '/p:Configuration=debug',
  '/p:Platform=anycpu',
  '/p:AppxBundle=Never' ] { stdio: 'inherit' }
C:\Users\Lukas\Desktop\Schulapp\Schulapp\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: Das importierte Projekt "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Microsoft.VisualStudio..Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datentr�ger vorhanden ist.
(node:14856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): code: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1 No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1


#15

Yeah, that’s normal.

The output indicates it didn’t catch. Did you restart your command line?
You can use SET MSBUILDDIR in the command line to check if it is recognized.

If this also doesn’t work, you can set the env var VSINSTALLDIR to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\ and try that one - although this should not be necessary.


#16

Thank you very much! It worked after I restarted my CLI.
The build was successful and a new directory was created. One last question: I have never worked with windows apps - which of those files is that one I should start to test the app? Because there is no .exe file…?


#17

Very nice :slight_smile:

Could you please create an issue at https://github.com/apache/cordova-windows including all the output you posted here? One day maybe someone can fix that you had to set this ENV var.

The .appx is something like an installer I think.


#18

Thanks a lot! I will create the issue!