Open caiovictor opened 1 year ago
First off, RNW 0.70 is no longer supported, please use a supported version of RNW: https://microsoft.github.io/react-native-windows/support
Also, how did you create the libraries? It looks like you ran npx react-native init
and created app projects named MyLibrary. That's an app project with a library name - please use the instructions for making a new library project: https://microsoft.github.io/react-native-windows/docs/native-modules-setup#creating-a-new-native-module-library-project
Since you want to use the nugets, please include the experimental nuget flag when creating the library projects too - that will prevent the spurious project entries in the solution file.
Finally, the output give suggests a command to fix the error. Did you try running the command?
This issue is reported on an older version of React Native for Windows than is current, and is believed to be fixed in the latest version. Please try to update to the latest version and confirm if your issue still occurs. Per-version documentation is available here
First off, RNW 0.70 is no longer supported, please use a supported version of RNW: https://microsoft.github.io/react-native-windows/support
Also, how did you create the libraries? It looks like you ran
npx react-native init
and created app projects named MyLibrary. That's an app project with a library name - please use the instructions for making a new library project: https://microsoft.github.io/react-native-windows/docs/native-modules-setup#creating-a-new-native-module-library-projectSince you want to use the nugets, please include the experimental nuget flag when creating the library projects too - that will prevent the spurious project entries in the solution file.
Finally, the output give suggests a command to fix the error. Did you try running the command?
Thanks for the reply @jonthysell
I hadn't seen that v0.70 was no longer supported :grimacing:
But I created the app with these commands that I put in the readme.
And yes, I included experimental nuget flag, here.
I'll try it on a supported version and give you feedback ASAP.
The same error happens for RNW 0.71. I added on this repo: https://github.com/caiovictor/rnw-071-experimental-nuget
Steps:
Using react: 18.1.0 react-native: ^0.71.0 react-native-windows: 0.71.27
Also tested on 0.72 and error persist.
Added on https://github.com/caiovictor/rnw-072-experimental-nuget
react: 18.2.0 react-native: 0.72.3 react-native-windows: 0.72.4
Quick update, I found an weird condition on autolink source, where always is added Microsoft.ReactNative.Managed and Microsoft.ReactNative.Managed.CodeGen in CSharp native modules, but using experimental nugets we dont need this.
So, I created a patch in my repo v0.71 experimental nuget to @react-native-windows/cli. I just added an condition to verify if experimental nuget flag is enabled, if so, we don't add those projects in the solution, otherwise, we add them normally as before.
This way the app build normally.
I would like to know if this really can be the fix for this issue, if so can I open a PR for this.
I would like to know if this really can be the fix for this issue, if so can I open a PR for this.
Thanks for your repro on 0.71! Yes, if the app project is building and your csharp lib is getting registered and available to the JS, then your fix looks fine and please open a PR.
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:
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
Expected Results
The solution (app + library) is expected to build correctly.
CLI version
9.3.4
Environment
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