Workload checking not scoped to runtime
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
Building a project fails if the workloads for frameworks excluded by conditions are not installed. On hosted CI/CD agents without the required workloads pre-installed (such as the Microsoft-hosted agents building a MAUI app), this necessitates installing extra workloads, which lengthens build times.
### To Reproduce
1. `dotnet new maui`.
2. From the new MAUI project, reference a project for an Android binding library.
3. Push the MAUI project and the binding library.
4. With an Azure Pipeline and the [macOS-14](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md) Microsoft-hosted agent, build the MAUI project for iOS:
```
dotnet workload install maui-ios
dotnet publish -f net8.0-ios
```
### Error
> /Users/runner/.dotnet/sdk/8.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: android [/Users/runner/work/1/s/MyAndroidBindingProject/MyAndroidBindingProject/MyAndroidBindingProject.csproj]
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.