[dotnet] no default $(RuntimeIdentifier) for class libraries (#12093)

Context: https://github.com/dotnet/maui/pull/1578

In the latest xamarin-macios bump, the dotnent/maui build started
failing because the `$(OutputPath)` of all the projects changed from:

    bin/Debug/net6.0-ios/
    bin/Debug/net6.0-maccatalyst/

To:

    bin/Debug/net6.0-ios/iossimulator-x64/
    bin/Debug/net6.0-maccatalyst/maccatalyst-x64/

Class library projects appear to have `$(RuntimeIdentifier)` set by
default. I don't think this is needed, because class libraries do not
need to be compiled as `--self-contained` apps.

On the Android side, we only set a default `$(RuntimeIdentifiers)` for
application projects:

7c5fab1332/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets (L49-L61)

I think the correct change here is to check:

    '$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true'

So Apple platforms only put a default `$(RuntimeIdentifier)` for
applications or extensions.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
Jonathan Peppers 2021-07-13 06:14:08 -05:00 коммит произвёл GitHub
Родитель 9207b5940e
Коммит 33f8143b97
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -28,7 +28,7 @@
</PropertyGroup>
<!-- Set the default RuntimeIdentifier if not already specified. -->
<PropertyGroup Condition=" '$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifiers)' == '' ">
<PropertyGroup Condition=" ('$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true') And '$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifiers)' == '' ">
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'iOS'">iossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'tvOS'">tvossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'macOS'">osx-x64</RuntimeIdentifier>