microsoft / react-native-xaml

A React Native Windows library to use XAML / WinUI controls
MIT License
97 stars 28 forks source link

MSB4011 warning when building #258

Closed MaxBen93 closed 1 year ago

MaxBen93 commented 1 year ago

Problem Description

When building ReactNativeXaml.vcxproj there is a warning being emitted due to a double-import of ExperimentalFeatures.props

<path>\node_modules\react-native-windows\PropertySheets\JSEngine.props(4,3): warning MSB4011: "<path>\ExperimentalFeatures.props" cannot be imported again. It was already imported at "<path>\node_m
odules\react-native-xaml\windows\ReactNativeXaml\ReactNativeXaml.vcxproj (3,3)". This is most likely a build authoring error.
This subsequent import will be ignored.

This is likely because ReactNativeXaml.vcxproj does its own import of that props file, while this is already being done by JSEngine.props which is imported by way of existing RNW imports.

If the order isn't important, this should be resolveable by removing the explicit import from ReactNativeXaml.vcxproj

Steps To Reproduce

  1. Clone this repo
  2. Build ReactNativeXaml.vcxproj

Expected Results

Clean output - free of errors and warnings.

Environment

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.23509
    CPU: (24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores
    Memory: 36.69 GB / 63.86 GB
  Binaries:
    Node: 16.19.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    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: Not Found
    Visual Studio: 17.6.33815.320 (Visual Studio Enterprise 2022), 16.11.33801.447 (Visual Studio Enterprise 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
chrisglein commented 1 year ago

@jonthysell Made some fixes for this awhile ago: https://github.com/search?q=repo%3Amicrosoft%2Freact-native-windows%20MSB4011&type=code What version are you on? If you're on an older version you can potentially take that spot fix.

Or is the problem that react-native-xaml specifically has a misconfigured property here?

chrisglein commented 1 year ago

@jonthysell Can you ensure that rn-xaml has the right configuration here?

jonthysell commented 1 year ago

All RN app and lib projects are expected to import, ExperimentalFeatures.props, it's necessary so every project is "on the same page".

The "extra" import in JSEngine.props was a workaround to support old module/app projects that havent updated to the latest template and don't have that nexessary import.

This was fixed in RN 0.71 with this commit: https://github.com/microsoft/react-native-windows/commit/492918196886cddef131fd1ec446a97c0c428693

It added a prop that could be set in your ExperimentalFeatures.props file to prevent JSEngine.props from importing it again.