Specifying both RuntimeIdentifier + RuntimeIdentifiers can confuse the build.
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Repro:
```xml
net10.0-ios
ios_plain
Exe
enable
true
iossimulator-arm64;ios-arm64
ios-arm64
```
then do:
```
dotnet build -p:RuntimeIdentifier=ios-arm64
```
results in:
```
$ dotnet build -p:RuntimeIdentifier=ios-arm64
Restore complete (0.4s)
ios-plain net10.0-ios ios-arm64 failed with 1 error(s) and 2 warning(s) (13.8s) → bin/Debug/net10.0-ios/ios-arm64/ios-plain.dll
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.5/26.5.10280/targets/Xamarin.Shared.Sdk.targets(335,3): warning RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file.
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.5/26.5.10280/targets/Xamarin.Shared.Sdk.targets(2064,3): error
clang++ exited with code 1:
ld: building for 'iOS-simulator', but linking in dylib (/Users/rolf/test/dotnet/ios-plain/obj/Debug/net10.0-ios/ios-arm64/nativelibraries/libSystem.Globalization.Native.dylib) built for 'iOS'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Build failed with 1 error(s) and 2 warning(s) in 14.7s
```
The problem is that `_SdkIsSimulator` ends up `true` here:
https://github.com/dotnet/macios/blob/8302f79a1b46f22ecd65ef4dbaca200801a61159/dotnet/targets/Xamarin.Shared.Sdk.props#L152
which is executed before we clear up the RuntimeIdentifier/RuntimeIdentifiers conflict here:
https://github.com/dotnet/macios/blob/8302f79a1b46f22ecd65ef4dbaca200801a61159/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets#L22-L31
The fix is likely to move that last code before where `_SdkIsSimulator` is calculated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.