Skip to content

Commit 1d4c367

Browse files
authored
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.
1 parent f37158e commit 1d4c367

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build-tools/create-packs/ConfigureLocalWorkload.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@
9090
Targets="_GenerateXAWorkloadContent"
9191
/>
9292

93-
<GetAndroidWorkloadExtends Condition="!$([MSBuild]::IsOSPlatform('linux'))" JsonFilePath="$(_LocalAndroidManifestFolder)WorkloadManifest.json">
93+
<GetAndroidWorkloadExtends Condition="!$([MSBuild]::IsOSPlatform('linux')) or '$(GITHUB_ACTIONS)' != 'true'" JsonFilePath="$(_LocalAndroidManifestFolder)WorkloadManifest.json">
9494
<Output TaskParameter="ExtendsElement" PropertyName="AndroidWorkloadExtendsElement" />
9595
</GetAndroidWorkloadExtends>
9696

9797
<PropertyGroup>
98-
<!-- Linux can fail to install "microsoft-net-runtime-android-aot" and Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86 -->
99-
<AndroidWorkloadExtendsElement Condition="$([MSBuild]::IsOSPlatform('linux'))">&quot;microsoft-net-runtime-android&quot;</AndroidWorkloadExtendsElement>
98+
<!-- Copilot on Linux can fail to install "microsoft-net-runtime-android-aot" and Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86 -->
99+
<AndroidWorkloadExtendsElement Condition="$([MSBuild]::IsOSPlatform('linux')) and '$(GITHUB_ACTIONS)' == 'true'">&quot;microsoft-net-runtime-android&quot;</AndroidWorkloadExtendsElement>
100100
<_EmptyWorkloadJsonContent>
101101
<![CDATA[
102102
{"version": "0.0.1", "workloads": { "android-deps": { "extends" : [ $(AndroidWorkloadExtendsElement) ] } } }

0 commit comments

Comments
 (0)