Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[One .NET] properly set $(UseAppHost) to false #6417

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

jonathanpeppers
Copy link
Member

Context: dotnet/sdk#19891
Context: https://github.com/xamarin/xamarin-macios/blob/a6eb528197854c074d9dd5847328c096890337be/dotnet/targets/Xamarin.Shared.Sdk.props#L38-L52

We currently have a small hack in place to prevent Linux packages from
being used in .NET 6 builds:

<!-- HACK: workaround for: https://github.com/dotnet/sdk/issues/19891 -->
<Target Name="_RemoveLinuxFrameworkReferences"
    AfterTargets="ProcessFrameworkReferences">
  <ItemGroup>
    <_ProblematicRIDs Include="linux-arm;linux-arm64;linux-x86;linux-x64" />
    <PackageDownload Remove="Microsoft.AspNetCore.App.Runtime.%(_ProblematicRIDs.Identity)" />
    <PackageDownload Remove="Microsoft.NETCore.App.Host.%(_ProblematicRIDs.Identity)" />
  </ItemGroup>
</Target>

The Xamarin.iOS team found if you set this late during
$(AfterMicrosoftNETSdkTargets):

<_RuntimeIdentifierUsesAppHost>false</_RuntimeIdentifierUsesAppHost>
<UseAppHost>false</UseAppHost>

Then Microsoft.NETCore.App.Host.* packs won't be brought in.

After making this change, I can remove this line from the workaround:

<PackageDownload Remove="Microsoft.NETCore.App.Host.%(_ProblematicRIDs.Identity)" />

The final solution for dotnet/sdk#19891, will be a future change that
makes Microsoft.AspNetCore.App.Runtime have a way to ignore
unsupported platforms.

Context: dotnet/sdk#19891
Context: https://github.com/xamarin/xamarin-macios/blob/a6eb528197854c074d9dd5847328c096890337be/dotnet/targets/Xamarin.Shared.Sdk.props#L38-L52

We currently have a small hack in place to prevent Linux packages from
being used in .NET 6 builds:

    <!-- HACK: workaround for: dotnet/sdk#19891 -->
    <Target Name="_RemoveLinuxFrameworkReferences"
        AfterTargets="ProcessFrameworkReferences">
      <ItemGroup>
        <_ProblematicRIDs Include="linux-arm;linux-arm64;linux-x86;linux-x64" />
        <PackageDownload Remove="Microsoft.AspNetCore.App.Runtime.%(_ProblematicRIDs.Identity)" />
        <PackageDownload Remove="Microsoft.NETCore.App.Host.%(_ProblematicRIDs.Identity)" />
      </ItemGroup>
    </Target>

The Xamarin.iOS team found if you set this late during
`$(AfterMicrosoftNETSdkTargets)`:

    <_RuntimeIdentifierUsesAppHost>false</_RuntimeIdentifierUsesAppHost>
    <UseAppHost>false</UseAppHost>

Then `Microsoft.NETCore.App.Host.*` packs won't be brought in.

After making this change, I can remove this line from the workaround:

    <PackageDownload Remove="Microsoft.NETCore.App.Host.%(_ProblematicRIDs.Identity)" />

The final solution for dotnet/sdk#19891, will be a future change that
makes `Microsoft.AspNetCore.App.Runtime` have a way to ignore
unsupported platforms.
@jonathanpeppers
Copy link
Member Author

We can ignore the 1 test failure here:

[BT : 1.8.1] error : Error retrieving device SDK version. Please try again. [/Users/runner/work/1/s/bin/TestRelease/temp/TestAndroidStoreKeyTrueTrueaabTrueandroid_ks test.keystoreTrue/UnnamedProject.csproj]
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2516,3): error : java.lang.IllegalStateException :  Error retrieving device SDK version. Please try again. [/Users/runner/work/1/s/bin/TestRelease/temp/TestAndroidStoreKeyTrueTrueaabTrueandroid_ks test.keystoreTrue/UnnamedProject.csproj]

    0 Warning(s)
    2 Error(s)

@jonathanpeppers jonathanpeppers merged commit e0f3683 into dotnet:main Oct 25, 2021
@jonathanpeppers jonathanpeppers deleted the useapphost-false branch October 25, 2021 13:14
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants