Skip to content

Commit 441a56a

Browse files
authored
add devcontainer.json config for .net 6 -Codespaces (#2149)
## Why this change? Enhance the PR review experience in GitHub Codespaces. Currently, review productivity is hindered because the default Codespaces container only has .NET 8. (While there is work to add .net 8 to dab, this fix enables .net6 (current) compat in codespaces). Pros: - Everything that is needed is pre-installed in container: - .NET 6 SDK -> allows you to "view definition" and other symbols with intellisense - C# Dev Kit VsCode extension -> view solution , run tests etc. - No need to update this file when DAB is updated to build against .NET 8. Cons: - Slower to load CodeSpace because container needs to build (1-3 minutes), but once built, easy access for future PR iterations. ## What is this change? - Docs used: - https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/setting-up-your-dotnet-project-for-codespaces - https://github.com/devcontainers/features/tree/main/src/dotnet - Adds folder `.devcontainer` - Adds file `devcontainer.json` which - Uses .net 8 sdk image for future compatibility with DAB changes in #2140 . - Installs .net 6 SDK, Runtime, and ASPNETCORE - Installs C#devKit Vscode extension ## Actual experience 1. When loading codespaces you'll see this container setup after selecting which codespace to create or reuse. ![image](https://github.com/Azure/data-api-builder/assets/6414189/5b95e689-969e-420c-8158-f3ccf0d2e694) 2. Auto install required extensions to make intellisense work: ![image](https://github.com/Azure/data-api-builder/assets/6414189/3f28f400-e69e-475a-aa51-783f41feeb1b) 3. Solution explorer works ![image](https://github.com/Azure/data-api-builder/assets/6414189/9cfd6218-2d40-4f90-81b9-5f280af40e1e) 4. Working intellisense! ![image](https://github.com/Azure/data-api-builder/assets/6414189/6763194a-c916-4286-8805-6c41f62f16fd)
1 parent 812c142 commit 441a56a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": ".NET 8 with .NET 6",
3+
"image": "mcr.microsoft.com/dotnet/sdk:8.0",
4+
"features": {
5+
// https://github.com/devcontainers/features/tree/main/src/dotnet
6+
"ghcr.io/devcontainers/features/dotnet:2": {
7+
"version": "latest",
8+
"dotnetRuntimeVersions": "6.0",
9+
"aspNetCoreRuntimeVersions": "6.0",
10+
"additionalVersions": "6.0"
11+
}
12+
},
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [ "ms-dotnettools.csdevkit" ]
16+
}
17+
},
18+
"remoteEnv": {
19+
// https://docs.github.com/en/codespaces/developing-in-a-codespace/persisting-environment-variables-and-temporary-files#for-all-codespaces-for-a-repository
20+
// Set .NET tools directory to PATH since not automatically done by SDK image.
21+
"PATH": "${containerEnv:PATH}:/root/.dotnet/tools"
22+
}
23+
}

0 commit comments

Comments
 (0)