Skip to content

Commit 713a72e

Browse files
Fix ReactWindows-Desktop build break
`//vnect/Shared/Shared.vcxitems` is included by two project: 1. `//vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj` 2. `//vnext/Desktop/React.Windows.Desktop.vcxproj` (2) is a static library that breaks due to compiler errors due to `ReactNativeHost.cpp` including `XamlApplication.h` which in turn includes `Xaml.XamlApplication.g.*` which requires `XamlApplication.idl` to be generating them. This won’t happen due to the project type of (2). Wrap `XamlApplication`-related code in a macro and define it only for (1).
1 parent af97183 commit 713a72e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
DISABLE_XAML_GENERATED_MAIN;
125125
REACTWINDOWS_BUILD;
126126
RN_PLATFORM=windows;
127+
RNW_XAML_ISLAND;
127128
NOMINMAX;
128129
FOLLY_CFG_NO_COROUTINES;
129130
FOLLY_NO_CONFIG;

vnext/Microsoft.ReactNative/ReactNativeHost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#include <winrt/Windows.Foundation.Collections.h>
1414
#include "IReactContext.h"
1515
#include "ReactInstanceSettings.h"
16+
#ifdef RNW_XAML_ISLAND
1617
#include "XamlApplication.h"
18+
#endif // RNW_XAML_ISLAND
1719

1820
#include <Fabric/Composition/Modal/WindowsModalHostViewComponentView.h>
1921
#include <Fabric/WindowsComponentDescriptorRegistry.h>
@@ -103,9 +105,11 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
103105
}
104106
}
105107

108+
#ifdef RNW_XAML_ISLAND
106109
if (componentregistry->isXamlSupportRequired()) {
107110
winrt::Microsoft::ReactNative::Xaml::implementation::XamlApplication::EnsureCreated();
108111
}
112+
#endif // RNW_XAML_ISLAND
109113

110114
ReactPropertyBag(m_instanceSettings.Properties()).Set(ReactNativeHostProperty(), get_weak());
111115

0 commit comments

Comments
 (0)