Dubious Visual Studio 2017/2019 Professional msbuild error
Although there could be better ways to set the config explicitly to a specific msbuild path, I'm just sharing here what I did to get my gulp msbuild task working.
My sln built fine with VS 2017 Professional edition but was receiving the below error when built using gulp task. Mainly this VS 2019 path was non-existent in the machine: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe
Instead, had this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe
Also, my config file values related to gulp task correctly pointed to the 2017 Professional MSBuild path. As a final resort, since my machine had both VS 2017 and VS 2019 versions, once I uninstalled Visual Studio 2019, msbuild worked fine in the gulp task using the 2017 Professional msbuild path. Remember to restart PowerShell before you re-run the gulp task.
I later found that someone had a similar issue with Community edition and one of the answers suggested (not accepted though) is similar to my situation. So, now I'm convinced my error and solution are real.
Order of events:
1. AWS Workspace with both Visual Studio 2017 and Visual Studio 2019 (both Professional) installed
2. Due to space constraints, removed Visual Studio 2019 Professional also, my sln built fine in VS 2017 Professional
3. Next saw my gulp build failing and probably misunderstood as lack of VS 2019 and so re-installed VS 2019 but Community edition this time
4. Even now I had gulp build errors and this is when I noticed the non-existent VS 2019 Professional path
5. So, uninstalled VS 2019 Community edition and now just had VS 2017 Professional edition
6. Now, gulp build task worked fine
In my opinion, somewhere in the registry the ms build path was still pointing to non-existent 2019 Professional path and that was probably removed during VS 2019 Community edition uninstall.
Error:
[17:17:53] { Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall:
'spawn C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\15.0\\Bin\\amd64\\MSBuild.exe',
path:
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\15.0\\Bin\\amd64\\MSBuild.exe',
spawnargs:
[ 'C:\\gulp\\xxxx-website\\xxx.yyy.sln',
'/target:Build',
'/verbosity:minimal',
'/toolsversion:15.0',
'/nologo',
'/maxcpucount',
'/nodeReuse:False' ] }
[17:17:53] MSBuild failed!
Comments
Post a Comment