Skip to content

Update Copilot setup to use .NET SDK version from tools.dotnet #11891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 23, 2025

Our repository uses a non-standard approach to specifying the .NET SDK version in global.json. Instead of using the standard sdk.version property, we use the Arcade-specific tools.dotnet element.

This PR updates the Copilot setup steps to:

  1. Extract the SDK version from tools.dotnet using jq
  2. Pass the extracted version to setup-dotnet using the dotnet-version parameter

Before this change, Copilot was using the global-json-file parameter which doesn't understand our custom structure, potentially using an incorrect SDK version.

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+      
+      - name: Extract SDK version from global.json
+        id: sdk-version
+        run: |
+          SDK_VERSION=$(jq -r '.tools.dotnet' global.json)
+          echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
+          echo "Extracted .NET SDK version: $SDK_VERSION"

      - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # 4.3.1
        with:
-          global-json-file: global.json
+          dotnet-version: ${{ env.SDK_VERSION }}

Fixes #11890.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

@Copilot Copilot AI changed the title [WIP] Teach Copilot setup about our SDK version Update Copilot setup to use .NET SDK version from tools.dotnet May 23, 2025
@Copilot Copilot AI requested a review from rainersigwald May 23, 2025 17:05
Copilot finished work on behalf of rainersigwald May 23, 2025 17:05
@rainersigwald rainersigwald marked this pull request as ready for review May 23, 2025 17:09
@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 17:09
@rainersigwald rainersigwald requested a review from a team as a code owner May 23, 2025 17:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the GitHub Actions workflow to pull the .NET SDK version from the custom tools.dotnet property in global.json and supply it directly to actions/setup-dotnet.

  • Added a step to extract the SDK version using jq and set it in the environment
  • Switched setup-dotnet from global-json-file to the extracted dotnet-version parameter
Comments suppressed due to low confidence (2)

.github/workflows/copilot-setup-steps.yml:20

  • [nitpick] Ensure this new step’s indentation matches the existing steps (two extra spaces), so it aligns under steps: with other - uses: entries.
- name: Extract SDK version from global.json

.github/workflows/copilot-setup-steps.yml:23

  • [nitpick] Verify that jq is available on the runner (or add an install step) to avoid failures on environments where jq isn’t preinstalled.
SDK_VERSION=$(jq -r '.tools.dotnet' global.json)

- name: Extract SDK version from global.json
id: sdk-version
run: |
SDK_VERSION=$(jq -r '.tools.dotnet' global.json)
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a validation after extraction (e.g., fail early if $SDK_VERSION is empty) to catch errors when tools.dotnet is missing or malformed.

Suggested change
SDK_VERSION=$(jq -r '.tools.dotnet' global.json)
SDK_VERSION=$(jq -r '.tools.dotnet' global.json)
if [ -z "$SDK_VERSION" ]; then
echo "Error: .NET SDK version is missing or malformed in global.json" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.

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.

Teach Copilot setup about our SDK version
2 participants