Skip to content

Commit

Permalink
[0.69] Disable RestoreUseStaticGraphEvaluation for VS >= 17.6 (#11691)
Browse files Browse the repository at this point in the history
This PR backports #11681 to 0.69. (Note: Building 0.69 with VS 2022 is not officially supported.)

## Description

This PR disables `RestoreUseStaticGraphEvaluation` if building within Visual Studio >= 17.6, which is not working in our project.

Ideally we want `RestoreUseStaticGraphEvaluation` to improve the build speed. However this will unblock folk trying to build our code within the newest versions of Visual Studio.

This does not impact building via MSBuild (i.e. using the `run-windows` CLI command).

Resolves #11670

### Type of Change
- Bug fix (non-breaking change which fixes an issue)

### Why
Unblock building with VS >= 17.6

Resolves #11670

### What
Adds a check for the version of VS to the condition setting `RestoreUseStaticGraphEvaluation`.

## Screenshots
N/A

## Testing
Verified I can build `Microsoft.ReactNative.sln` with VS 17.6 and 17.5.
  • Loading branch information
jonthysell committed Jun 1, 2023
1 parent 46a427a commit 7322301
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[0.69] Disable RestoreUseStaticGraphEvaluation for VS >= 17.6",
"packageName": "react-native-windows",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}
5 changes: 3 additions & 2 deletions vnext/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@
</PropertyGroup>

<PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
<!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
<!-- See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target -->
<!-- RestoreUseStaticGraphEvaluation broke in VS 17.6, see https://github.com/microsoft/react-native-windows/issues/11670 -->
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND $([MSBuild]::VersionLessThan('$(MSBuildVersion)', '17.6')) AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

</Project>
5 changes: 3 additions & 2 deletions vnext/PropertySheets/NuGet.Cpp.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

<PropertyGroup Label="NuGet">
<!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
<!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
<!-- See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target -->
<!-- RestoreUseStaticGraphEvaluation broke in VS 17.6, see https://github.com/microsoft/react-native-windows/issues/11670 -->
<RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND $([MSBuild]::VersionLessThan('$(MSBuildVersion)', '17.6')) AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>

<!-- Ensure PackageReference compatibility for any consuming projects/apps -->
<ResolveNuGetPackages>false</ResolveNuGetPackages>
Expand Down

0 comments on commit 7322301

Please sign in to comment.