You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Android workload detection issue on Linux builds (#10216)
Fixes: #10215
Context: 20de949
This PR fixes an issue where Android workload detection was failing on
Linux during local builds, causing the error:
error NETSDK1147: To build this project, the following workloads must be installed: android
To install these workloads, run the following command: dotnet workload restore
## Root Cause
The issue was in
`build-tools/create-packs/ConfigureLocalWorkload.targets` where the
Linux-specific workload configuration was using only
`"microsoft-net-runtime-android"` as the extends element, while
non-Linux platforms were dynamically extracting the full extends array
from the WorkloadManifest.json file.
The full extends array includes additional required dependencies:
- `"microsoft-net-runtime-android-net9"`
- `"microsoft-net-runtime-android"`
- AOT dependencies (which are excluded on Linux due to compatibility
issues)
To fix this, we can check `$(GITHUB_ACTIONS)` env var to decide if
we should run the workaround or not.
<GetAndroidWorkloadExtendsCondition="!$([MSBuild]::IsOSPlatform('linux')) or '$(GITHUB_ACTIONS)' != 'true'"JsonFilePath="$(_LocalAndroidManifestFolder)WorkloadManifest.json">
<!--Copilot on Linux can fail to install "microsoft-net-runtime-android-aot" and Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86 -->
99
+
<AndroidWorkloadExtendsElementCondition="$([MSBuild]::IsOSPlatform('linux')) and '$(GITHUB_ACTIONS)' == 'true'">"microsoft-net-runtime-android"</AndroidWorkloadExtendsElement>
0 commit comments