I am having issues with building a new cordova project for Windows.
I have the following versions installed:
So, to reproduce:
cordova create project1
cd project1
cordova platform add windows
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?
Had today the same problem and you pointed me in the right direction - thanks!
The cause for this is, that the cordova build command looks in the registry for the MSBuild path, but since Visual Studio 2017 Microsoft doesn't write the path in the registry anymore (more on this here)
As workaround i created in the registry the following key (don't forget to change the path):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0]
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\amd64"
After that the cordova build worked!
Another solution would be just to install VS 2015, but in my case this was not an option, because I use the sqlite plugin in my app and the current version can only be build with VS 2017 for windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With