为Windows桌面构建React Native应用程序时出现问题



我正在尝试为Windows构建我的第一个React Native应用程序,我正在按照主站点的说明进行操作:https://microsoft.github.io/react-native-windows/docs/getting-started

基本上是:

1) npx react-native init fiveTest --template react-native
2) cd fiveTest/
3) npx react-native-windows-init --overwrite
4) npx react-native run-windows

尽管如此,在运行最后一个命令后,我面临着这个问题

C:gitrepodanielfiveTestnode_modulesreact-native-windowsMsodispatchQueuedispatchQueue.h(728,17): error C2607: static assertion failed [C:gitrepodanielfiveTestnode_modulesreact-native-windowsMicrosoft.ReactNativeMicrosoft.ReactNative.vcxproj]
C:Program Files (x86)Windows Kits10bin10.0.19041.0XamlCompilerMicrosoft.Windows.UI.Xaml.Common.targets(486,5): error MSB4181: The "CompileXaml" task returned false but did not log an error. [C:gitrepodanielfiveTestnode_modulesreact-native-windowsMicrosoft.ReactNativeMicrosoft.ReactNative.vcxproj]
Done Building Project "C:gitrepodanielfiveTestnode_modulesreact-native-windowsMicrosoft.ReactNativeMicrosoft.ReactNative.vcxproj" (default targets) -- FAILED.
Done Building Project "C:gitrepodanielfiveTestwindowsfivetestfivetest.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "C:gitrepodanielfiveTestwindowsfivetest.sln" (default targets) -- FAILED.
- Build failed with message Building Solution - error code 1. Check your build configuration.
× Build failed with message Building Solution - error code 1. Check your build configuration.

有什么建议或建议可以解决吗?,有人成功构建Windows应用程序吗?

提前谢谢。当做丹尼尔。

这是VS 2022 17.1更新的一个问题。我改为使用Visual Studio 2019修复了它。

显然,RN Windows尚未正式支持VS 2022:https://github.com/microsoft/react-native-windows/pull/9562

最新更新