Skip to content

Latest commit

 

History

History
93 lines (77 loc) · 4.35 KB

File metadata and controls

93 lines (77 loc) · 4.35 KB
id version-0.63-nuget-update
title Updating NuGet packages
original_id nuget-update

This documentation and the underlying platform code is a work in progress.

The versions of the NuGet packages used in your project must match the version of the react-native-windows npm package.

Determine npm version

You can find the npm version by opening package.json at the root of your project and looking in the dependencies section:

{
  "name": "MyProject"
  ...
  "dependencies": {
    ...
    "react-native-windows": "0.63.0"
  },
  ...

In this example the npm version for react-native-windows is 0.63.0. Note that if you use preview, Your version might include a preview marker like 0.64.0-preview.3.

Determine and update the NuGet version

For Windows there are two project types: C++ and C#. If you don't know which one you can look in the windows/MyProject folder. If you find a MyProject.vcxproj file, you have a C++ project. If you find a MyProject.csproj file, you have a C# project. Each project type has different instructions. For either you can use both the Visual Studio IDE or a text editor. Note: The Visual Studio IDE only runs on Windows and is not the same as Visual Studio Code. If you use Visual Studio for Mac, please follow the text editor instructions.

C# project - Text editor

  1. Open windows/MyProject/MyProject.csproj in a text editor
  2. Find the Package reference section:
     <PackageReference Include="Microsoft.ReactNative.Managed">
       <Version>0.63.0</Version>
     </PackageReference>
  3. Change the version element.

C# project - Visual Studio IDE

  1. Open the solution in Visual Studio

  2. Right-Click on the C# project file MyProject (Universal Windows) in the Solution Explorer window

    Visual Studio Solution Explorer showing the csproj project selected

  3. Select "Managed NuGet Packages..."

  4. Select the "Installed" tab

    Visual Studio Manage NuGet dialog showing the installed tab selected

  5. If the npm version has a hyphen with a preview marker, you must check the "Include Prerelease" per the image above.

  6. Select the package Microsoft.ReactNative.Managed

  7. Select the version of your npm package in the version drop-down on the right side.

    Visual Studio Managed NuGet dialog with the version drop-down selected.

  8. Click install

  9. Close the dialog and save your project

C++ project - Text editor

  1. Open windows/MyProject/packages.config in a text editor.
  2. Update the version attributes of both Microsoft.ReactNative and Microsoft.ReactNative.Cxx packages
  3. Open windows/MyProject/MyProject.vcxproj in a text editor.
  4. Perform a search and replace for:
    • packages\Microsoft.ReactNative.0.63.0
    • packages\Microsoft.ReactNative.Cxx.0.63.0 and replace it with the the version number of the npm package. There should be multiple strings to replace.

C++ project - Visual Studio IDE

  1. Open the solution in Visual Studio

  2. Right-Click on the C++ project file MyProject (Universal Windows) in the Solution Explorer window

    Visual Studio Solution Explorer showing the vcxproj project selected

  3. Select "Managed NuGet Packages..."

  4. Select the "Installed" tab

    Visual Studio Manage NuGet dialog showing the installed tab selected

  5. If the npm version has a hyphen with a preview marker, you must check the "Include Prerelease" per the image above.

  6. Perform the next two steps for both Microsoft.ReactNative and Microsoft.ReactNative.Cxx packages:

    1. On the right side, from the version drop-down select the version of your npm package

      Visual Studio Managed NuGet dialog with the version drop-down selected.

    2. Click install

  7. Close dialog and save your project