Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 10, 2025

Problem

The existing devcontainer configuration had two critical issues preventing proper project setup:

  1. Wrong .NET SDK version: The devcontainer was installing the "latest" .NET SDK (8.0.119) but the project requires .NET 9.0.101 as specified in global.json
  2. Missing private NuGet feed authentication: No mechanism to authenticate with the IntelliTect Azure DevOps private feed containing EssentialCSharp.Shared.Models and ContentFeedNuget packages

This resulted in developers being unable to restore packages or build the project within the devcontainer.

Solution

1. Updated DevContainer Configuration

Modified .devcontainer/devcontainer.json to:

  • Install the correct .NET 9.0 SDK version matching global.json
  • Pass through the AZURE_DEVOPS_PAT environment variable for private feed authentication
  • Use a comprehensive setup script for initialization

2. Created Intelligent Setup Script

The new .devcontainer/setup.sh provides:

  • Automatic .NET version verification and SDK listing
  • Smart private feed detection: Configures Azure DevOps authentication when PAT token is available
  • Graceful fallback: Automatically falls back to public packages if authentication fails
  • Idempotent operation: Can be safely re-run without conflicts
  • Clear user guidance: Provides actionable next steps and troubleshooting information

3. Enhanced Documentation

Updated README.md with:

  • Step-by-step devcontainer setup instructions
  • Azure DevOps PAT creation and configuration guide
  • Clear explanations for both private feed and public-only scenarios

Key Features

For developers with private feed access:

export AZURE_DEVOPS_PAT="your-azure-devops-token"
# Open in devcontainer -> automatic setup with private packages

For developers without private feed access:

# Simply open in devcontainer -> automatic fallback to public packages

Robust error handling:

  • Detects authentication failures and provides clear guidance
  • Automatically removes/re-adds NuGet sources to prevent conflicts
  • Falls back to AccessToNugetFeed=false when private feed is unavailable

Testing

✅ Package restore works without private feed access
✅ Build and tests pass with .NET 9.0.101
✅ Authentication flow works with valid PAT tokens
✅ Graceful fallback when authentication fails
✅ Script is idempotent and handles re-runs correctly

The devcontainer now mirrors the GitHub Actions workflow authentication approach, ensuring consistent behavior between CI/CD and local development environments.

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:

  • api.hcaptcha.com
    • Triggering command: /home/REDACTED/.dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp.Web/EssentialCSharp.Web/EssentialCSharp.Web.Tests/bin/Release/net9.0/EssentialCSharp.Web.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp.Web/EssentialCSharp.Web/EssentialCSharp.Web.Tests/bin/Release/net9.0/EssentialCSharp.Web.Tests.deps.json /home/REDACTED/work/EssentialCSharp.Web/EssentialCSharp.Web/EssentialCSharp.Web.Tests/bin/Release/net9.0/testhost.dll --port 46133 --endpoint 127.0.0.1:046133 --role client --parentprocessid 4053 --telemetryoptedin false (dns block)

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


💬 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 10, 2025

@BenjaminMichaelis Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository and had to close this PR. The error I am seeing is:

No `copilot-setup-steps` job found in your `copilot-setup-steps.yml` workflow file. Please ensure you have a single job named `copilot-setup-steps`. For more details, see https://gh.io/copilot/actions-setup-steps.

Once you or someone with the necessary access fixes the problem, please unassign and then reassign issue #0 to me and I'll retry. Thanks!

Copilot AI changed the title [WIP] Fix devcontainer to be able to properly restore project. Reference @IntelliTect/EssentialCSharp.Web/files/.github/workflows/Build-Test-And-Deploy.yml as needed, make sure to implement private nuget feed authentication for our private nuget feed. Fix devcontainer for private NuGet feed authentication and .NET 9.0 support Sep 10, 2025
Copilot finished work on behalf of BenjaminMichaelis September 10, 2025 15:52
@BenjaminMichaelis BenjaminMichaelis force-pushed the copilot/fix-a91c7306-d374-48e4-90e1-13cb5841fb1c branch from 43b94c5 to cafee7f Compare September 10, 2025 15:57
@BenjaminMichaelis BenjaminMichaelis assigned Copilot and unassigned Copilot Sep 10, 2025
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