react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

[0.70] Move required PackageReference properties into shared property sheets

Open jonthysell opened this issue 3 years ago • 0 comments

This PR backports #10567 to 0.70.

Description

The switch to PackageReference sprinkled required properties in each individual app/lib project file, instead of putting them in to the shared property sheets.

This means that customers upgrading from earlier versions of RNW must add these properties to every project they consume. So app customers must add the correct properties to their app projects when upgrading to 0.68+, and also to each native module project they depend on.

Moving the properties in to the shared props (that every project consumes) means that they all get their benefit.

Resolves #10538

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

What

Set the NuGet properties such as AssetTargetFallback, ResolveNuGetPackages, TargetFrameworkMoniker, and RestoreUseStaticGraphEvaluation in the shared property sheets, and removed their hardcoded values in our projects and templates.

Why

Projects built with older templates need these properties but might not otherwise get upgraded.

Test

I created a brand new RN 0.67 project, added RNW 0.67, and added react-native-camera as a dependency. I confirmed that the project built and ran as expected with yarn windows.

Then I manually upgraded the package.json with [email protected], and [email protected]. Then I ran react-native-windows-init pointing to my local repo (with these changes) to upgrade the windows files with the fixed template.

Finally I ran yarn windows and confirmed that all packages were restored, the app and native modules built, deployed, and ran.

Microsoft Reviewers: Open in CodeFlow

jonthysell avatar Sep 14 '22 16:09 jonthysell