Skip to content

Add workloads input parameter for .NET workload installation - #3

Draft
v-HarithaVattikuti with Copilot wants to merge 6 commits into
mainfrom
copilot/add-workloads-parameter
Draft

Add workloads input parameter for .NET workload installation#3
v-HarithaVattikuti with Copilot wants to merge 6 commits into
mainfrom
copilot/add-workloads-parameter

Conversation

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown

Description:

The .NET SDK ships with workloads (MAUI, Aspire, WASM, etc.) that require explicit installation. This adds opt-in support for installing workloads after SDK setup.

Implementation:

  • New input parameter: workloads (multiline, optional) in action.yml
  • Installation logic: Runs dotnet workload update then dotnet workload install with all workloads in a single command for performance
  • Error handling: Update failures warn but continue; installation failures abort
  • Execution condition: Only runs when both workloads and dotnet-version are provided
  • E2E test: Added test-setup-with-workloads job to validate workload installation across ubuntu, windows, and macos platforms
  • Test fix: Updated the workload verification script to properly convert PowerShell output to string for regex matching

Usage:

- uses: actions/setup-dotnet@v5
  with:
    dotnet-version: 8.0.x
    workloads: |
      maui
      aspire

Related issue:
Implements feature request for workload installation support.

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.
Original prompt

Please create a pr to introduce new input parameter as workloads for this action as below example: Description:
The SDK ships with supporting a set of workloads (Wasm, MAUI, Aspire, and potentially more in the future). The setup-dotnet action should support these as further instructions to actually 'setup' the full dotnet environment as expected, not automatically, but opt-in.

uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
workloads: [maui, aspire]
The expectation is that after SDK would be installed that then command would run dotnet workload update (to ensure manifests are updated) and then dotnet workload install on each item in the array

Justification:
Workloads are a primary way to get additional platform SDK tools and dependencies for key .NET frameworks. one implementation note is that the list of workloads provided can be supplied to dotnet workload install all in one go, because the command takes an array of workloads. This should result in a performance improvement.

One subtlety to the situation is that instead of installing various workloads, we also support dotnet workload restore to acquire the workloads that a given solution or project require - that would be less 'variable' (meaning you wouldn't have to update the list of workloads).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 8, 2026 20:04
- Added 'workloads' input parameter to action.yml
- Implemented workload installation in setup-dotnet.ts
- Added tests for workload installation functionality
- Updated test mocks to handle new input parameter

Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
- Improved error handling to safely handle unknown error types
- Added README documentation for the workloads feature with examples

Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workloads parameter to setup-dotnet action Add workloads input parameter for .NET workload installation Jan 8, 2026
@v-HarithaVattikuti

Copy link
Copy Markdown
Owner

@copilot Can you add one job for this feature in e2e-tests.yml

- Added test-setup-with-workloads job to e2e-tests.yml
- Tests installation of wasm-tools workload on ubuntu, windows, and macos
- Verifies workload is properly installed using 'dotnet workload list'

Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
Author

@copilot Can you add one job for this feature in e2e-tests.yml

Added the e2e test job test-setup-with-workloads in commit 579dff6. The job:

  • Tests on ubuntu-latest, windows-latest, and macos-latest
  • Installs .NET 8.0.x with the wasm-tools workload
  • Verifies the workload is properly installed using dotnet workload list

@v-HarithaVattikuti

Copy link
Copy Markdown
Owner

@copilot Can you fix the CI failure

Convert dotnet workload list output to string for proper regex matching in PowerShell

Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
Author

@copilot Can you fix the CI failure

Fixed in commit 8cfffe6. The CI failure was caused by the workload verification test - the PowerShell script wasn't properly converting the multi-line output from dotnet workload list to a string for regex matching. Added | Out-String to fix it.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/HarithaVattikuti/setup-dotnet/actions/runs/20832539564/jobs
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants