Skip to content

Copilot agent runs dotnet commands with correct dotnet. #62879

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

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

ilonatommy
Copy link
Member

In agent mode in VSC copilot was always trying to run dotnet commands with global dotnet, not the one from the repo:

The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application 'test' does not exist.
  * You intended to execute a .NET SDK command:
      A compatible .NET SDK was not found.

Requested SDK version: 10.0.100-preview.7.25322.101
global.json file: C:\Users\Desktop\aspnetcore-fork4\global.json

Installed SDKs:
9.0.300 [C:\Program Files\dotnet\sdk]
9.0.302 [C:\Program Files\dotnet\sdk]

Install the [10.0.100-preview.7.25322.101] .NET SDK or update [C:\Users\Desktop\aspnetcore-fork4\global.json] to match an installed SDK.

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

After updating the instruction it does not happen anymore.

@ilonatommy ilonatommy requested a review from captainsafia July 23, 2025 12:17
@ilonatommy ilonatommy self-assigned this Jul 23, 2025
@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 12:17
@ilonatommy ilonatommy added the area-blazor Includes: Blazor, Razor Components label Jul 23, 2025
@ilonatommy ilonatommy requested review from wtgodbe and a team as code owners July 23, 2025 12:17
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 Copilot instructions to ensure that dotnet commands use the repository-specific .NET SDK version instead of the global installation. The change addresses issues where Copilot agent was attempting to run dotnet commands with an incompatible global .NET SDK when the repository requires a specific preview version.

  • Adds instructions for activating the local .NET environment before running dotnet commands
  • Provides platform-specific activation script commands for Windows and Linux/Mac
  • Ensures compatibility with the repository's global.json SDK requirements

@ilonatommy ilonatommy merged commit 2b95f33 into dotnet:main Jul 23, 2025
10 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview7 milestone Jul 23, 2025
@wtgodbe wtgodbe modified the milestones: 10.0-preview7, 10.0-rc1 Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants