Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 16, 2025

Sample projects in this repository that target .NET 9 (such as EverythingServer, AspNetCoreMcpServer, ProtectedMcpServer, etc.) were failing to build or run in GitHub Codespaces with the error:

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

Requested SDK version: 9.0.204
global.json file: /workspaces/csharp-sdk/global.json

Installed SDKs:
8.0.412 [/usr/share/dotnet/sdk]

Install the [9.0.204] .NET SDK or update [/workspaces/csharp-sdk/global.json] to match an installed SDK.

The root cause was that GitHub Codespaces' default container includes .NET 8 LTS but not .NET 9 STS, while the repository's global.json specifies .NET 9.0.204 and several sample projects target net9.0.

This adds a .devcontainer/devcontainer.json configuration that:

  • Uses the official Microsoft .NET 8 devcontainer as the base image
  • Installs .NET 9.0 SDK using the official devcontainer features (base image already provides .NET 8.0 SDK)
  • Includes Node.js to maintain parity with the default GitHub Codespace image
  • Configures VS Code with essential C# extensions and sets the default solution file
  • Provides a clear confirmation that both SDKs are available after container creation

Now developers can open the repository in GitHub Codespaces and immediately run any sample project without manual SDK installation:

cd samples/EverythingServer
dotnet run  # ✅ Works!

All existing .NET 8 samples continue to work normally, ensuring backward compatibility.

Fixes #776.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Sep 16, 2025

@eiriktsarpalis 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] Sample projects in this repo should "just work" in GitHub codespaces Add devcontainer.json to support .NET 9 samples in GitHub Codespaces Sep 16, 2025
@Copilot Copilot AI requested a review from eiriktsarpalis September 16, 2025 13:31
Copilot finished work on behalf of eiriktsarpalis September 16, 2025 13:31
@eiriktsarpalis eiriktsarpalis marked this pull request as ready for review September 16, 2025 13:45
@eiriktsarpalis
Copy link
Member

eiriktsarpalis commented Sep 16, 2025

Tested the codespace and it appears to be working now.

Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

This looks good but I think there are a couple small improvements we should make.

Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@eiriktsarpalis eiriktsarpalis merged commit f331a69 into main Sep 25, 2025
3 checks passed
@eiriktsarpalis eiriktsarpalis deleted the copilot/fix-776 branch September 25, 2025 08:42
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.

Sample projects in this repo should "just work" in GitHub codespaces

3 participants