问题
I get the No valid MSBuild was detected for the selected target
error when bulid cordova (build solution) for Windows platform with Microsoft visual studio community 2015 (ver 14 update 3).
And I also get Some of requirements check failed
when run cordova requirements
in project folder
Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: not installed
MSBuild tools v.14.0 not found. Please install Visual Studio 2015 Community from https://www.visualstudio.com/downloads/download-visual-studio-vs
Visual Studio: not installed
Required version of Visual Studio not found. Please install Visual Studio 2015 Community from https://www.visualstudio.com/downloads/download-visual-studio-vs
Windows SDK: not installed
Windows SDK not found. Please ensure that you have installed Windows 10.0 SDK along with Visual Studio or install Windows 10.0 SDK separately from https://dev.windows.com/en-us/downloads
Windows Phone SDK: not installed
Windows Phone SDK not found. Please ensure that you have installed Windows Phone 10.0 SDK along with Visual Studio or install Windows Phone 10.0 SDK separately from https://dev.windows.com/develop/download-phone-sdk
I'm runing on Windows 10 Enterprise 64 -bit
``` Things that I've tried
1) Base on cordova windows platforms guide i've already include below features when install visual studio
Universal windows app development Tools -> Tools (1.4) and Windows 10 SDK
Universal windows app development Tools -> Windows 10 SDK
and
Window 8.1 and windows phone 8.0/8.1 tools -> Tools and windows SKDs
2) My project is just a blank project that create from visual studio (and I tried with cordova create command also).
3) Add MSbuild path to system variable:
C:\Program Files (x86)\MSBuild\14.0\Bin
C:\Program Files (x86)\MSBuild\12.0\Bin (tried it also)
4) target windows 8.1 and 10
5) Build successful with android platform.
Thank for your help
回答1:
This is happening when you can't run reg.exe due to Windows Policies, please remove the registry entry DisableRegistryTools.
More info here
回答2:
Make sure you are using 'Command Prompt' and not some variation like 'Node JS Command Prompt'
来源:https://stackoverflow.com/questions/38219609/no-valid-msbuild-was-detected-for-the-selected-target-when-build-cordova-with