Skip to content

Commit e0f3683

Browse files
[One .NET] properly set $(UseAppHost) to false (#6417)
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.
1 parent 1ab4f23 commit e0f3683

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Application.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This file contains targets specific for Android application projects.
99
<Project>
1010

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

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ _ResolveAssemblies MSBuild target.
2020
<ItemGroup>
2121
<_ProblematicRIDs Include="linux-arm;linux-arm64;linux-x86;linux-x64" />
2222
<PackageDownload Remove="Microsoft.AspNetCore.App.Runtime.%(_ProblematicRIDs.Identity)" />
23-
<PackageDownload Remove="Microsoft.NETCore.App.Host.%(_ProblematicRIDs.Identity)" />
2423
</ItemGroup>
2524
</Target>
2625

0 commit comments

Comments
 (0)