Skip to content

Commit

Permalink
[One .NET] properly set $(UseAppHost) to false (#6417)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonathanpeppers authored Oct 25, 2021
1 parent 1ab4f23 commit e0f3683
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This file contains targets specific for Android application projects.
<Project>

<PropertyGroup>
<UseAppHost>false</UseAppHost>
<!-- see: https://github.com/xamarin/xamarin-macios/blob/a6eb528197854c074d9dd5847328c096890337be/dotnet/targets/Xamarin.Shared.Sdk.props#L38-L52 -->
<_RuntimeIdentifierUsesAppHost>false</_RuntimeIdentifierUsesAppHost>
<RunCommand>dotnet</RunCommand>
<RunArguments>build &quot;$(MSBuildProjectFullPath)&quot; -target:Run</RunArguments>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ _ResolveAssemblies MSBuild target.
<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>

Expand Down

0 comments on commit e0f3683

Please sign in to comment.