If you install .NET 6 RC1 and the Android workload, we are now using **FromWorkload** so a NuGet.config should no longer be needed when building Android projects.
Unfortunately, you get a different error now when testing this:
error NU1102: Unable to find package Microsoft.AspNetCore.App.Runtime.linux-arm64 with version (= 6.0.0-rc.1.21417.2)
Build log: msbuild.zip
I found I could workaround the problem with:
<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>
I will probably put this workaround in the Android workload for now.
This is probably related to the RID graph. I tried making an adjustment to the RID graph in the past, but they wouldn't accept this change:
dotnet/runtime#45927