2017-05-26 75 views
3

我有問題與建設一個新的Cordova項目的Windows。科爾多瓦爲Windows生成與Visual Studio 2017錯誤

我已經安裝了以下版本:

  • [email protected],但它也可以用[email protected]轉載
  • 的Visual Studio 2017年企業與工具的Apache科爾多瓦,Windows Mobile的仿真器和更多。
  • 安裝MS Build Tool v14 & v15。

所以,重現:

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

然後出現以下錯誤: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

當我向構建中添加--verbose標誌時,我注意到C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0,/v,MSBuildToolsPath命令未返回成功,因此它使用構建工具v14而不是v15。

如果我使用Visual Studio 2017創建了一個新項目,它將編譯&在Visual Studio中成功運行,但我在cordova build windows命令中遇到了同樣的錯誤。

我想這是正確的註冊表項安裝,它會正常工作。我應該如何正確添加它們?或者,Visual Studio在做什麼的時候沒有使用cordova或taco命令?

回答

3

今天有同樣的問題,你指出我在正確的方向 - 謝謝!

造成這種情況的原因是,該科爾多瓦建設命令在註冊表中查找的MSBuild的路徑,但由於Visual Studio的2017年微軟不寫下去了(關於這一點here

註冊表路徑

作爲解決方法我在註冊表中創建以下鍵(不要忘記改變路徑):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0] 
"MSBuildToolsPath"="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\amd64" 

此後,科爾多瓦構建工作!

另一種解決方案只是安裝VS 2015,但在我的情況下,這不是一個選項,因爲我在我的應用程序中使用SQLite插件,並且當前版本只能使用VS 2017 for windows構建。

相關問題