microsoft / microsoft/react-native-windows

Experimental nuget needs autolink-windows when app consumes library #csharp

Open
#11,976 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Autolinking bug Scenario: NuGet Workstream: New Arch NuGet Refactor
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

Hello everybody,

I work on an RNW v0.70.19 project where I have a csharp app that consumes a lot of csharp and cpp libraries, all in RNW as well. Recently I'm trying to use the experimental nuget to improve the build performance of my solution, but I've been having some problems making use of the experimental nuget in my project.

I had a lot of errors in my project, so I decided to test it in a new app to find out if my project's architecture is compatible with the RNW standard.

How I did an PoC of experimental nuget:

  1. I created a new app in csharp, because the app in my project is csharp.
  2. Also created two libraries, one in scharp and the other in cpp. Added both as dependencies in my app, installed and did autolink.
  3. I noticed the csharp library references Microsoft.ReactNative.Managed and Microsoft.ReactNative.Managed.CodeGen locally (from node_modules) projects, and even includes them within the solution.
  4. Then I removed manually this two projects of my solution and try to build again, but as these projects were added by autolink, I got autolink error.
    rnw-error-autolink

NOTE: If I added just cpp library, the solution build corretly. So I believe that the error is only in the csharp library.

Steps To Reproduce
  1. Clone https://github.com/caiovictor/rnw-070-experimental-nuget
  2. Open app solution ./myApp/windows/myApp.sln on VS and build.
  3. Get autolink error.
Expected Results

The solution (app + library) is expected to build correctly.

CLI version

9.3.4

Environment
react v18.1.0
react-native v0.70.10
react-native-windows v0.70.19
Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2019

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked PoC repository, open ./myApp/windows/myApp.sln in Visual Studio, and reproduce the autolink error while building. Compare the C# library setup with the working C++-only case and trace how the experimental NuGet projects are added by autolink; done means the app and library solution builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp, react-native
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.