Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
"image": "mcr.microsoft.com/devcontainers/dotnet",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "latest"
"version": "9.0"
}
},
"postCreateCommand": "dotnet --list-sdks"
"postCreateCommand": ".devcontainer/setup-nuget-auth.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit"
]
}
},
"remoteUser": "vscode"
}
54 changes: 54 additions & 0 deletions .devcontainer/setup-nuget-auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -e

echo "Setting up NuGet authentication for Azure DevOps..."

# Install Azure Artifacts Credential Provider
echo "Installing Azure Artifacts Credential Provider..."
if sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)" 2>/dev/null; then
echo "✅ Azure Artifacts Credential Provider installed successfully"
else
echo "⚠️ Could not download Azure Artifacts Credential Provider installer."
echo "This may be due to network restrictions. Falling back to public packages only."
export ACCESS_TO_NUGET_FEED=false
fi

# Display .NET version
echo "Checking .NET SDK version..."
dotnet --version

# Try to restore packages with interactive authentication if credential provider is available
echo "Attempting to restore NuGet packages..."
if command -v dotnet-credential-provider-installer >/dev/null 2>&1 || [ -n "$(find ~/.nuget -name "*CredentialProvider*" 2>/dev/null | head -1)" ]; then
echo ""
echo "🔐 The credential provider is available for Azure DevOps authentication."
echo "If prompted for credentials during package restoration, you can:"
echo " 1. Use your Azure DevOps account credentials, or"
echo " 2. Create a Personal Access Token (PAT) with 'Packaging (read)' permissions"
echo " from: https://dev.azure.com/intelliTect/_usersSettings/tokens"
echo ""

# First try to restore with interactive authentication for private packages
if dotnet restore --interactive -p:AccessToNugetFeed=true; then
echo "✅ Package restoration successful with private feed access!"
else
echo "⚠️ Private package restoration failed or was cancelled."
echo "Falling back to public packages only..."
if dotnet restore -p:AccessToNugetFeed=false; then
echo "✅ Package restoration successful with public packages only!"
else
echo "❌ Package restoration failed completely."
exit 1
fi
fi
else
echo "Credential provider not available, using public packages only..."
if dotnet restore -p:AccessToNugetFeed=false; then
echo "✅ Package restoration successful with public packages only!"
else
echo "❌ Package restoration failed."
exit 1
fi
fi

echo "🎉 Devcontainer setup complete!"
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml

EssentialCSharp.Web/Markdown/

EssentialCSharp.Web/Guidelines/
EssentialCSharp.Web/Markdown/

EssentialCSharp.Web/Guidelines/

# DevContainer environment files with sensitive data
.devcontainer/.env