当我运行ionic cordova build windows
时,它会引发类似-
> cordova build windows
ENV var MSBUILDDIR is set C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
Building project: C:\Users\shail\Desktop\ionic-demo\ionic-4-windows\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\\shail\\Desktop\\ionic-demo\\ionic-4-windows\\platforms\\windows\\CordovaApp.Windows10.jsproj',
'/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal',
'/nologo', '/p:Configuration=debug', '/p:Platform=anycpu', '/p:AppxBundle=Never'] { stdio: 'inherit' } C:\Users\shail\Desktop\ionic-demo\ionic-4-windows\platforms\windows\CordovaApp.Windows10.jsproj(61,5): error MSB4019: The imported project "C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Microsoft.VisualStudio..Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
No valid MSBuild was detected for the selected target: Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild: Command failed with exit code 1
有谁能帮助解决这个问题。
ionic -v是4.12.0
cordove -v是9.0.0
已安装平台
科尔多瓦平台清单
Installed platforms:
android 8.0.0
windows 7.0.0
使用Visual Studio 2017 Enterprise
答案 0 :(得分:0)
根据错误消息:msbuild工具的路径为 无效。
1。对于vs2017,您使用的msbuild应该是C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
而不是C:\Program Files (x86)\MSBuild\14.0\bin
。
2。此外,v14.0适用于vs2015,而v15.0适用于vs2017,请将设置中的所有“ v14.0”更改为“ v15.0”并运行。