React-native-windows: Build failed with message Error: MSBuild tools not found. Check your build configuration.

Created on 7 May 2019  路  31Comments  路  Source: microsoft/react-native-windows

image

bug

Most helpful comment

Anyone knows how to run it on vs 2019?

Pretty sure it's going to be related to a lack of support here:

<yourapp>\node_modules\react-native-windows\local-cli\runWindows\utils\msbuildtools.js

I can get it to finish building and start by (and please don't do this and expect anything but a hack, but...) doing the following in the checkMSBuildVersion() function, just before the final return:

if (version === "16.0") {
   toolsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin"
}

In order to get that to be called, I updated the array of possible version values at line 12 of the file to:

MSBUILD_VERSIONS = ['16.0', '15.0', '14.0', '12.0', '4.0'];

Finally, you need to hack the buildProject() function as well to handle VS2019 version numbers... look for the comment around line 40 referring to VS2017 and do something similar for V16/VS2019.

if (this.version === '16.0') {
  args.push('/p:PlatformToolset=v142');
  args.push('/p:VisualStudioVersion=16.0');
}

Also
To be super clear - this is for a machine with VS2019 _only_ (no VS2017 installation) and the vNext template. Also, YMMV, and this is a hack - just to get up and running to play. Don't leave your code like this in the long haul, even if you get it working.

UPDATE: there's a tracking issue for VS2019 support here: https://github.com/microsoft/react-native-windows/issues/2320 .

All 31 comments

Can you provide details of your setup? Which VS version, Windows SDK, setup steps are you running?

I also got this issue, I'm on Win 10 Insider Preview 18890, VS 2019 (as per requirements VS2017 or greater).

Followed Getting-started-current and failed on that step (run on VS/run-windows).

Installed C++ workload and MSVC/ATL 141 build tools. Still fails.

I had the same issue until I installed VS 2017 specifically.

I was able to solve using v-next

https://youtu.be/kvfuGsOA_T8

I can build success with sln but still get error "Build failed with message Error: MSBuild tools not found. Check your build configuration."
rnw

Anyone knows how to run it on vs 2019?

Anyone knows how to run it on vs 2019?

Pretty sure it's going to be related to a lack of support here:

<yourapp>\node_modules\react-native-windows\local-cli\runWindows\utils\msbuildtools.js

I can get it to finish building and start by (and please don't do this and expect anything but a hack, but...) doing the following in the checkMSBuildVersion() function, just before the final return:

if (version === "16.0") {
   toolsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin"
}

In order to get that to be called, I updated the array of possible version values at line 12 of the file to:

MSBUILD_VERSIONS = ['16.0', '15.0', '14.0', '12.0', '4.0'];

Finally, you need to hack the buildProject() function as well to handle VS2019 version numbers... look for the comment around line 40 referring to VS2017 and do something similar for V16/VS2019.

if (this.version === '16.0') {
  args.push('/p:PlatformToolset=v142');
  args.push('/p:VisualStudioVersion=16.0');
}

Also
To be super clear - this is for a machine with VS2019 _only_ (no VS2017 installation) and the vNext template. Also, YMMV, and this is a hack - just to get up and running to play. Don't leave your code like this in the long haul, even if you get it working.

UPDATE: there's a tracking issue for VS2019 support here: https://github.com/microsoft/react-native-windows/issues/2320 .

@stratospheres Tank you very much! It's works!

The same here, MS should fix this ASAP

Build failed with message Error: MSBuild tools not found. Check your build configuration. facing with the same issue can any one help to solve this, Thanks in advance

I tried with both the VS 2017 as well as 2019 and even tried doing above hack. But not succeed. Getting same error.
Does anyone know about any other work around? Thanks.

I can build success with sln but still get error "Build failed with message Error: MSBuild tools not found. Check your build configuration."
rnw

I tried with both the VS 2017 as well as 2019 and even tried doing above hack. But not succeed. Getting same error.
Does anyone know about any other work around? Thanks.

So frustrating that this doesn't work with MS' own latest dev tools and doesn't work with the latest version of react native. I wish MS would devote more resources to this project.

Apologies on this. As @stratospheres pointed out, we are working on making the CLI for vnext work with VS 2019. Issue #2320 is tracking this (we just submitted a first PR #2539) .

You can follow the Advanced install method specified here - Advanced install for working on vNext with VS 2019 until we fix the buildpath issues with the CLI.

@harinikmsft Thanks for addressing issue and giving workaround.

We merged a couple of fixes yesterday (#2539 and #2396). Please try it out and let us know if you are still seeing issues.

Closing as verified locally. Please reopen if you are still seeing issues post the fixes from PRs #2539 and #2396

@harinikmsft, still facing the same issue with rnwindows 0.57 versions.
I have VS2017 and VS2019 installed.

Sorry to hear that @hmheng. @marlenecota - can you take a look again?

@harinikmsft Even same behavior for me. :( It's not working.

Same here on version 0.57.1, haven't tried vnext since due to lack of transform animation.

Ah, my fix was only for vnext. @ShrinathGupta were you also using current?

If we upgrade to vnext, it works fine on Windows, but it will break android compilation. I haven't try ios yet.

Ah, my fix was only for vnext. @ShrinathGupta were you also using current?

@marlenecota Yes i was using vnext and i was building uwp app.

@hmheng, @ShrinathGupta - 0.57.2 and 0.58.0-rc.2 have been patched. Please give that a go.

@marlenecota thank you..
My reactnative version is RN 0.57..

PS D:PSReposRNWindows> react-native windows --template current
Reading application name from package.json...
Reading react-native version from node_modules...
Checking for react-native-windows version matching 0.57....
Could not find [email protected].
-current.*.

However, if I use react-native windows --windowsVersion ~0.57.. it works with RNW0.57.2

For RN 0.58..
it looks good with RNW 0.58.-rc.2
thank you

@marlenecota It has been long time since i worked on it. Good news today i checked and it worked. Awesome thanks @marlenecota :clap: :100:

If anybody wants to give a try to react native windows vnext.
They can try https://github.com/ShrinathGupta/React-native-windows-demo
It's awesome. I worked on previous version of it, vnext is far better then that although development is still ongoing.

Sounds like this is resolved.

Anyone knows how to run it on vs 2019?

Pretty sure it's going to be related to a lack of support here:

<yourapp>\node_modules\react-native-windows\local-cli\runWindows\utils\msbuildtools.js

I can get it to finish building and start by (and please don't do this and expect anything but a hack, but...) doing the following in the checkMSBuildVersion() function, just before the final return:

if (version === "16.0") {
   toolsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin"
}

In order to get that to be called, I updated the array of possible version values at line 12 of the file to:

MSBUILD_VERSIONS = ['16.0', '15.0', '14.0', '12.0', '4.0'];

Finally, you need to hack the buildProject() function as well to handle VS2019 version numbers... look for the comment around line 40 referring to VS2017 and do something similar for V16/VS2019.

if (this.version === '16.0') {
  args.push('/p:PlatformToolset=v142');
  args.push('/p:VisualStudioVersion=16.0');
}

Also
To be super clear - this is for a machine with VS2019 _only_ (no VS2017 installation) and the vNext template. Also, YMMV, and this is a hack - just to get up and running to play. Don't leave your code like this in the long haul, even if you get it working.

UPDATE: there's a tracking issue for VS2019 support here: #2320 .

just provided "msbuild.exe" path to "toolsPath" var ,

in "node_modulesreact-native-windowslocal-clirunWindowsutilsmsbuildtools.js"

and now it is working ,

thank you.

Anyone knows how to run it on vs 2019?

Pretty sure it's going to be related to a lack of support here:

<yourapp>\node_modules\react-native-windows\local-cli\runWindows\utils\msbuildtools.js

I can get it to finish building and start by (and please don't do this and expect anything but a hack, but...) doing the following in the checkMSBuildVersion() function, just before the final return:

if (version === "16.0") {
   toolsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin"
}

In order to get that to be called, I updated the array of possible version values at line 12 of the file to:

MSBUILD_VERSIONS = ['16.0', '15.0', '14.0', '12.0', '4.0'];

Finally, you need to hack the buildProject() function as well to handle VS2019 version numbers... look for the comment around line 40 referring to VS2017 and do something similar for V16/VS2019.

if (this.version === '16.0') {
  args.push('/p:PlatformToolset=v142');
  args.push('/p:VisualStudioVersion=16.0');
}

Also
To be super clear - this is for a machine with VS2019 _only_ (no VS2017 installation) and the vNext template. Also, YMMV, and this is a hack - just to get up and running to play. Don't leave your code like this in the long haul, even if you get it working.
UPDATE: there's a tracking issue for VS2019 support here: #2320 .

just provided "msbuild.exe" path to "toolsPath" var ,

in "node_modulesreact-native-windowslocal-clirunWindowsutilsmsbuildtools.js"

and now it is working ,

thank you.

Can you explain this in more detail, please?

Was this page helpful?
0 / 5 - 0 ratings