如何修复运行“react-native run-windows”时的构建错误?

Mat*_*ett 4 windows msbuild visual-studio react-native

在新初始化的 React Native 应用程序中运行后react-native windows,如果立即运行react-native run-windows会发生此错误:

Build failed with message Error: Command failed: "C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" "C:/<path_to_project>/windows/<project_name>.sln" /clp:NoSummary;NoItemAndProperty;Verbosity=minimal /nologo /p:Configuration=debug /p:Platform=x86 . Check your build configuration.

Mat*_*ett 6

当您安装了 Visual Studio,但在尝试使用某些命令行工具之前从未将其启动为“devenv.exe”时,可能会发生这种情况。在命令调用命令行工具之前,首次启动 Visual Studio 时会发生一些额外的设置react-native run-windows

有关详细信息,请参阅 React Native Windows 故障排除部分: https://github.com/microsoft/react-native-windows/blob/0.60-stable/current/docs/SetupTroubleshooting.md