Skip to content

Commit

Permalink
Update NuGet docs and remove formerly deleted files (#964)
Browse files Browse the repository at this point in the history
## Description

This updates the docs to reflect the changes made in
microsoft/react-native-windows#13338

### Why
To clean up and clarify the NuGet support situation for RNW.

## Screenshots
N/A

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/react-native-windows-samples/pull/964)
  • Loading branch information
jonthysell authored Aug 27, 2024
1 parent d4b7c50 commit 519c8c4
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 259 deletions.
2 changes: 2 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ Node.js
non-ABI-safe
npm
NuGet
NuGets
nvs
packages.config
PDBs
PluralSight
PowerShell
pre-built
pre-filtered
pre-installed
preprocessor
Expand Down
92 changes: 0 additions & 92 deletions docs/nuget-update.md

This file was deleted.

54 changes: 6 additions & 48 deletions docs/nuget.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,14 @@ title: Using Microsoft.ReactNative NuGet packages

>**This documentation and the underlying platform code is a work in progress.**
The default for React Native Windows has been to build all code from source. This includes building all the code shipped by the team in the npm package from source. This code can be quite large and take a long time to build as well as require a high-performance computer. Some configurations have problems building this code with only 8 GB of memory. Especially if you are used to working only with managed code, this can be a big surprise.
When creating a new project in [Get Started with Windows](getting-started.md), the type of template selected for the [init-windows command](init-windows-cli.md) will determine whether or not the project will built against the `react-native-windows` source or the pre-built NuGet packages.

Starting with version 0.64 the team offers experimental NuGet packages that can be used as a replacement of compiling the sources.
Traditionally, the default for React Native Windows has been to build all code from source. This includes building all the code shipped by the team in the npm package from source. The amount of code is quite large and takes both a long time to build as well as requiring a high-performance computer. Some configurations have problems building this code with only 8 GB of memory. Especially if you are used to working only with managed code, this can be a big surprise.

> Disclaimer: There are known compatibility issues with [community modules](supported-community-modules.md), as they still rely on building the shared code from source. So the solution still needs to have all the source projects which puts all the build performance problems back.
Starting with the (currently experimental) New Architecture (i.e. Fabric) app and module projects, React Native Windows will default to consuming pre-built binary NuGet packages instead of requiring you to compile everything yourself.

The benefit of using NuGet packages is that you get improved compilation times for your Windows project and can develop on a less powerful computer.
The benefit of using NuGet packages is that you get improved compilation times for your Windows project and can develop on a less powerful computer. This will also translate into a smoother update experience for newer versions of `react-native-windows`.

The other benefit will be that it will be easier to update your projects to future versions of `react-native-windows`.
> **Note on new projects:** Building from source will remain the default for new Old Architecture projects. This is because there are known compatibility issues with [community modules](supported-community-modules.md), as they often still rely on building the shared code from source, making the parallel use of NuGets problematic.
# How to enable on new projects
When creating a new project in [Get Started with Windows](getting-started.md), the templates used by the [init-windows command](init-windows-cli.md) default to building against source. Follow the instructions below if you wish to try using the NuGet packages.

> Note: The formerly recommended [React Native Windows Init CLI](https://microsoft.github.io/react-native-windows/init-cli) still supports an `--experimentalNuGetDependency true` flag to set up a new project which uses the NuGet packages, but as that command is planned for deprecation, it's not recommended.
# How to update a previously created project
The steps below will help you modify your RNW project so you can consume the RNW NuGet packages.

> Note: If you're in the process of upgrading your app to a new version of RNW (See [Upgrading App to Latest Version of React Native Windows](upgrade-app.md)), and you've already set the `<UseExperimentalNuGet>true</UseExperimentalNuGet>` flag (as per below), the [init-windows command](init-windows-cli.md) will try to respect that setting so you shouldn't have to re-apply the manual steps below after the upgrade.
<!--DOCUSAURUS_CODE_TABS-->
<!--C# projects-->
1. Update the solution file `windows\<projectName>.sln`:
1. Open the project in Visual Studio
1. Remove all projects except your own app project
1. Edit the file `windows\ExperimentalFeatures.props`
1. Set the following to true
```xml
<UseExperimentalNuGet>true</UseExperimentalNuGet>
```
1. Edit the project file `windows\<projectName>\<projectName.csproj>`
1. Remove any `<ProjectReference>` or `<PackageReference>` references for `Microsoft.ReactNative.*` projects.

1. Update the C# logic for the new [compile-time C# codeGen](native-modules-csharp-codegen.md)

<!--C++ projects-->
> Note: Starting with version 0.68, React Native for Windows apps use `PackageReference`s for native `C++` NuGet dependencies. See [Managing C++ dependencies](managing-cpp-deps.md) about migrating away from use the older, `packages.config` for managing NuGet dependencies.

1. Update the solution file `windows\<projectName>.sln`:
1. Open the project in Visual Studio
1. Remove all projects that are not your project
1. Edit the file `windows\ExperimentalFeatures.props`
1. Set the following to true
```xml
<UseExperimentalNuGet>true</UseExperimentalNuGet>
```
1. Edit the project file `windows\<projectName>\<projectName.vcxproj>`
1. Remove any `<ProjectReference>` or `<PackageReference>` references for `Microsoft.ReactNative.*` projects.

<!--END_DOCUSAURUS_CODE_TABS-->

# Version match
The versions of the NuGet package in your project must match the npm package version. If you need to update the NuGet packages there is a separate page on [Updating NuGet packages](nuget-update.md)
> **Note on existing projects:** Previously exposed methods for building Old Architecture projects against NuGets were experimental and are being deprecated, and therefore should not be used. If you're in the process of upgrading an existing Old Architecture project that *did* use those experimental methods, the [init-windows command](init-windows-cli.md) will try to respect that setting until the methods are formally deprecated and removed.
7 changes: 0 additions & 7 deletions website/.unbroken_exclusions
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,8 @@ File not found supported-community-modules.md while parsing versioned_docs/versi
File not found testing.md while parsing versioned_docs/version-0.75/native-modules-setup.md
File not found run-windows-cli.md while parsing versioned_docs/version-0.75/native-modules-using.md
File not found native-modules-autolinking.md while parsing versioned_docs/version-0.75/native-modules-using.md
File not found assets/nuget-update-cpp-project.png while parsing versioned_docs/version-0.75/nuget-update.md
File not found assets/nuget-update-cs-project.png while parsing versioned_docs/version-0.75/nuget-update.md
File not found assets/nuget-update-packages-manager-installed-tab.png while parsing versioned_docs/version-0.75/nuget-update.md
File not found assets/nuget-update-select-package.png while parsing versioned_docs/version-0.75/nuget-update.md
File not found nuget.md while parsing versioned_docs/version-0.75/nuget-update.md
File not found getting-started.md while parsing versioned_docs/version-0.75/nuget.md
File not found nuget-update.md while parsing versioned_docs/version-0.75/nuget.md
File not found managing-cpp-deps.md while parsing versioned_docs/version-0.75/nuget.md
File not found upgrade-app.md while parsing versioned_docs/version-0.75/nuget.md
File not found native-modules-csharp-codegen.md while parsing versioned_docs/version-0.75/nuget.md
File not found supported-community-modules.md while parsing versioned_docs/version-0.75/nuget.md
File not found run-windows-cli.md while parsing versioned_docs/version-0.75/react-native-windows-cli.md
Expand Down
2 changes: 1 addition & 1 deletion website/pages/en/init-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class InitCli extends React.Component {
React Native Windows Init CLI
</h1>
<p>
This guide will give you more information on the React Native Windows Init CLI.
This guide will give you more information on the React Native Windows Init CLI. <b>Note:</b> This command will only work for RNW &lte; 0.75. If you are using RNW &gte; 0.76, you should use the <a href="/docs/init-windows"><code>init-windows</code> command</a> instead.
</p>
<h2><code>react-native-windows-init</code></h2>
<p>
Expand Down
3 changes: 1 addition & 2 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
],
"Experimental" : [
"hermes",
"NuGet",
"nuget-update"
"NuGet"
]
},
"apis": {
Expand Down
18 changes: 18 additions & 0 deletions website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,24 @@ const siteConfig = {
docsSideNavCollapsible: true,

customFields: require("./showcaseApps.json"),

deletedDocs: {
"0.75": [
"nuget-update",
],
"0.74": [
"coreapp",
"CoreAppPage",
],
"0.73": [
"winui3",
],
"0.72": [
"IReactPackageBuilderExperimental",
"IReactRootViewExperimental",
"apptheme",
]
}
};

module.exports = siteConfig;
93 changes: 0 additions & 93 deletions website/versioned_docs/version-0.75/nuget-update.md

This file was deleted.

Loading

0 comments on commit 519c8c4

Please sign in to comment.