Reputation: 41
I am trying to get a windows x64 build out of cordova but still no success. I get this error and I could not find anything in the forums that could help me, since all Cordova requirements are checked in my case.
No valid MSBuild was detected for the selected target: AppPackages folder doesn't exist
I have tried different addresses in MSBUILDDIR environment, no success so far. Cordova requirements also passes everything!
cordova requirements
ENV var MSBUILDDIR is set C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64
Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: installed 15.9
Visual Studio: installed (user-specified via VSINSTALLDIR)
Windows SDK: installed 10.0
Windows Phone SDK: installed 10.0
My computer is a x64 machine on a 64 bit windows 10 with an AMD Ryzen 5 2400G APU Any idea is very much appreciated
By the way I have fixed a couple of issues so far that I leave here in case it helps some one later:
Error: MSBuild v4.0 is not supported, aborting.
Fix: by setting environment variable VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
Even though Visual Studio 2017 was installed with Cordova libraries, still got bellow error:
Error: Windows SDK not found. Fix: by installing the SDK separately (https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)
Error: I got some errors pointing to Node.js Fix: Installed all Node.JS libraries in VS and also updated Cordova to the last version, one of those should have fixed it since it was gone after I did those
Upvotes: 4
Views: 5100
Reputation: 31
Personally, I prefer command-line tools. I had the same problem and managed to solve it by analyzing the output of those tools.
MSBuild v4.0 is not supported, aborting.
If you use cordova build windows --verbose
, you see some more information.
Then, you have to specify another MSBuild target. Cordova looks for those targets in the registry, but Visual Studio (at least 2017) doesn't touch the registry at all.
So, I added the Key MSBuildToolsPath
under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5\
(newly created) pointing at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\15.0\Bin
.
After doing that, you don't need to specify the environment variables MSBUILDDIR
and VSINSTALLDIR
. But I also installed the tools globally by hand (e.g. npm install -g cordova
), so using the tools provided by VS may require to use those env variables.
In my case, the build worked fine afterwards. Note however, that I installed VS Community 2017 and VS BuildTools. I used this post as "template": Cordova build windows on Windows 10 and VisualStudio 2017
Upvotes: 3