Cordova build for Windows with Visual Studio 2017 error

Viewed 4538

I am having issues with building a new cordova project for Windows.

I have the following versions installed:

  • cordova@7.0.0, but it can also be reproduced with cordova@6.5
  • Visual Studio 2017 Enterprise with Tools for Apache Cordova, Windows Mobile Emulator and more.
  • MS Build Tools v14 & v15 installed.

So, to reproduce:

  1. cordova create project1
  2. cd project1
  3. cordova platform add windows
  4. cordova build windows

Then the following error appears: error MSB4019: The imported project "C:\Program Files (86)\MSBuild\Microsoft\VisualStudio\v14.0\JavaScript\Micros oft.VisualStudio.WJProject.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk

When I add the --verbose flag to the build, I notice that the C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0,/v,MSBuildToolsPath command does not return success, so it uses the Build Tools v14 instead of v15.

If I create a new project with Visual Studio 2017, it compiles & run successfully within Visual Studio, but I have the same errors on cordova build windows command.

I suppose that is the proper registry key were installed, it would work fine. How should I add them properly? Or what is Visual Studio doing that is not being done with the cordova or taco command?

1 Answers
Related