-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Problem Description
I created a project by following instructions on get-started for react-native for windows, and choosed C#.
I created the project today, so I use the last version.
The 1st start of the project was good.
But as soon as I modifiy the .NET project to include my own code and nuget dependencies (PInvoke), I encounter this problem when building my project with react-native run-windows command:
Build failed with message 9:6>[project-path]\node_modules\react-native-windows\Microsoft.ReactNative.Managed.CodeGen\build\x64\Debug\Microsoft.ReactNative.Managed.CodeGen\netcoreapp3.1\win-x64.NETCoreApp,Version=v3.1.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' [[project-path]\node_modules\react-native-windows\Microsoft.ReactNative.Managed.CodeGen\Microsoft.ReactNative.Managed.CodeGen.csproj]. Check your build configuration.
I tried to clean the project from VS2022, but no results.
Steps To Reproduce
- Create react-native for windows project with C#
- Open project sln with Visual Studio 2022
- Add some code and include a nuget dependency (PInvoke in my case)
- Run npx react-native run-windows
Expected Results
It has to build and launch my project !
CLI version
8.0.2
Environment
Languages:
Java: javac 17 - C:\Program Files\Eclipse Foundation\jdk-17.0.0.35-hotspot\bin\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.0 => 0.69.0
react-native-windows: ^0.69.1 => 0.69.1
npmGlobalPackages:
*react-native*: Not FoundTarget Platform Version
10.0.19041
Target Device(s)
Desktop
Visual Studio Version
Visual Studio 2022
Build Configuration
Debug
Snack, code example, screenshot, or link to a repository
No response