Skip to content

Commit 6ef92c8

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

5 files changed

Lines changed: 55 additions & 9 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 != '' }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/lib-commonjs/utils/msbuildtools.js b/lib-commonjs/utils/msbuildtools.js
2+
index a9304027f047b9e737a1de6e534aea1812704bd4..9f4ad135b6548506dde09e285afaa33852ee0988 100644
3+
--- a/lib-commonjs/utils/msbuildtools.js
4+
+++ b/lib-commonjs/utils/msbuildtools.js
5+
@@ -105,10 +105,7 @@ class MSBuildTools {
6+
if (enableParallelBuilds) {
7+
args.push('/maxCpuCount');
8+
}
9+
- if (target === 'build') {
10+
- args.push('/restore', '/p:RestorePackagesConfig=true');
11+
- }
12+
- else {
13+
+ if (target !== 'build') {
14+
args.push(`/t:Deploy`);
15+
}
16+
Object.keys(msBuildProps).forEach(key => {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"@nx/js/picomatch": "^4.0.4",
7272
"@nx/workspace/picomatch": "^4.0.4",
7373
"@react-native-windows/cli/@xmldom/xmldom": "^0.9.0",
74+
"@react-native-windows/cli@npm:0.83.0": "patch:@react-native-windows/cli@npm%3A0.83.0#~/.yarn/patches/@react-native-windows-cli-npm-0.83.0-2d6aa101ac.patch",
7475
"@react-native-windows/telemetry/@xmldom/xmldom": "^0.9.0",
7576
"appium/ajv": "~8.18.0",
7677
"appium/axios": "^1.15.0",

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>

yarn.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,6 +3510,37 @@ __metadata:
35103510
languageName: node
35113511
linkType: hard
35123512

3513+
"@react-native-windows/cli@patch:@react-native-windows/cli@npm%3A0.83.0#~/.yarn/patches/@react-native-windows-cli-npm-0.83.0-2d6aa101ac.patch":
3514+
version: 0.83.0
3515+
resolution: "@react-native-windows/cli@patch:@react-native-windows/cli@npm%3A0.83.0#~/.yarn/patches/@react-native-windows-cli-npm-0.83.0-2d6aa101ac.patch::version=0.83.0&hash=1cfcc6"
3516+
dependencies:
3517+
"@react-native-windows/codegen": "npm:0.83.0"
3518+
"@react-native-windows/fs": "npm:0.83.0"
3519+
"@react-native-windows/package-utils": "npm:0.83.0"
3520+
"@react-native-windows/telemetry": "npm:0.83.0"
3521+
"@xmldom/xmldom": "npm:^0.7.7"
3522+
chalk: "npm:^4.1.0"
3523+
cli-spinners: "npm:^2.2.0"
3524+
envinfo: "npm:^7.5.0"
3525+
execa: "npm:^5.0.0"
3526+
find-up: "npm:^4.1.0"
3527+
glob: "npm:^7.1.1"
3528+
lodash: "npm:^4.17.15"
3529+
mustache: "npm:^4.0.1"
3530+
ora: "npm:^3.4.0"
3531+
prompts: "npm:^2.4.1"
3532+
semver: "npm:^7.3.2"
3533+
shelljs: "npm:^0.8.4"
3534+
username: "npm:^5.1.0"
3535+
xml-formatter: "npm:^2.4.0"
3536+
xml-parser: "npm:^1.2.1"
3537+
xpath: "npm:^0.0.27"
3538+
peerDependencies:
3539+
react-native: "*"
3540+
checksum: 10c0/ce53b656464c47a18e04b06b6eeb3075da3d960f548787e8a44528c96ff334fa17ecc3ccd25160ea7b765aa4c82573f5de4a37ddefe36b709effe0ed43bf8210
3541+
languageName: node
3542+
linkType: hard
3543+
35133544
"@react-native-windows/codegen@npm:0.83.0":
35143545
version: 0.83.0
35153546
resolution: "@react-native-windows/codegen@npm:0.83.0"

0 commit comments

Comments
 (0)