Windows: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute
MacKenzieHnC opened this issue · 3 comments
Bug report
Summary
EDIT: Okay, this is the root issue. Still working on how to solve it, but it seems to only affect C#
Reproducible sample code
A different issue pops up in a minimal repro, but I think they have the same root cause.
Payload contains two or more files with the same destination path 'Microsoft.UI.Xaml.Markup.winmd', but they have different content
Repro: https://github.com/MacKenzieHnC/DocumentPickerBug
I'm pretty sure the error comes from this change. Look at the additions to windows/DocumentPickerBug.sln
.
I'm not sure that that's the error, but it seems most likely to me right now.
Steps to reproduce
- New project using current RNW
- Install this module
- Build fails
Environment info
npx react-native info
output:
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Memory: 7.00 GB / 15.93 GB
Binaries:
Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 9.2.0 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 29, 30, 31, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1
System Images: android-28 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: 22.1.7171670
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.17763.0, 10.0.18362.0, 10.0.19041.0, 10.0.22000.0, 10.0.22621.0
IDEs:
Android Studio: AI-221.6008.13.2211.9514443
Visual Studio: 17.5.33424.131 (Visual Studio Community 2022)
Languages:
Java: 11.0.18 - C:\Program Files\Microsoft\jdk-11.0.18.10-hotspot\bin\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.0 => 0.71.0
react-native-windows: 0.71.1 => 0.71.1
npmGlobalPackages:
*react-native*: Not Found
library version: 8.1.3
iOS / Android version: N/A
For reasons I cannot comprehend, changing the target platform version in ReactNativeDocumentPicker.csproj
from
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == ''">10.0.18362.0</TargetPlatformVersion>
to
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == ''">10.0.19041.0</TargetPlatformVersion>
fixes the minimal repro,
EDIT: but not the original project, so I guess they aren't the same error after all. I'll try and find what other module is playing badly with this.
I still don't know what the core issue is, but there's a ton of duplicate errors coming from the included Microsoft.React.Managed
projects
EDIT: And I've now managed to reproduce the bugs on a new blank module, so it's not unique to this module.
Managed to get a workaround, but I don't feel good about it. I just followed every error to the file it listed and commented out the offending code. Commenting auto-generated code does not feel like a valid solution, but we're kind of at Microsoft's whims for the time being.
I can close this if you want, but, while the bug doesn't originate here, it certainly affects this repo.