Skip to content

Commit 4bcaa6f

Browse files
committed
ci(windows): manually restore NuGet packages before building
1 parent acdd633 commit 4bcaa6f

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ jobs:
570570
- name: Determine whether the Windows app needs to be built
571571
id: affected
572572
uses: ./.github/actions/affected
573+
- name: Restore NuGet packages
574+
if: ${{ steps.affected.outputs.windows != '' }}
575+
run: |
576+
MSBuild -property:Configuration=${{ matrix.configuration }} -property:Platform=${{ matrix.platform }} -target:Restore
577+
working-directory: packages/example-windows/windows
573578
- name: Build
574579
id: build
575580
if: ${{ steps.affected.outputs.windows != '' }}

packages/app/windows/Win32/ReactApp.vcxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<ImportGroup Label="ExtensionSettings">
6868
</ImportGroup>
6969
<ImportGroup Label="PropertySheets">
70-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
7171
</ImportGroup>
7272
<ImportGroup Label="ReactNativeWindowsPropertySheets">
7373
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.props" />
@@ -143,14 +143,7 @@
143143
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
144144
<ImportGroup Label="ReactNativeWindowsTargets">
145145
<Import Project="$(ReactAppSharedDir)\EmbedManifest.targets" />
146-
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.targets')" />
146+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.targets" />
147147
<!-- ReactTestApp additional targets -->
148148
</ImportGroup>
149-
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
150-
<PropertyGroup>
151-
<ErrorText>This project references targets in your node_modules\react-native-windows folder. The missing file is {0}.</ErrorText>
152-
</PropertyGroup>
153-
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.props'))" />
154-
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Composition.CppApp.targets'))" />
155-
</Target>
156149
</Project>

packages/example-windows/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build:android": "rnx-cli bundle --platform android",
88
"build:ios": "rnx-cli bundle --platform ios",
99
"build:windows": "rnx-cli bundle --platform windows",
10-
"ci:windows": "rnx-cli run-windows --logging --no-packager --no-launch --no-deploy --msbuildprops UseBundle=false --no-telemetry",
10+
"ci:windows": "rnx-cli run-windows --logging --no-packager --no-launch --no-deploy --msbuildprops RestorePackages=false,RestorePackagesConfig=false,UseBundle=false --no-telemetry",
1111
"clean": "yarn workspace react-native-test-app clean",
1212
"ios": "rnx-cli run --platform ios",
1313
"set-react-version": "yarn workspace react-native-test-app set-react-version",

0 commit comments

Comments
 (0)