Skip to content

Commit 2aea244

Browse files
authored
Improve DevContainer configuration for Codespaces (#91465)
Adds a default configuration that comes with all the dependencies preinstalled, but not prebuilt. This reduces confusion if you don't use the "New with options..." dropdown when creating the Codespace since you'd just get a standard Ubuntu container then. Also install a specific version of dotnet-serve.
1 parent f6b6415 commit 2aea244

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed
File renamed without changes.

.devcontainer/devcontainer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// For format details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "Standard configuration",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"args": {
7+
// Update 'VARIANT' to pick a .NET Core version: 6.0, 7.0
8+
"VARIANT": "6.0-jammy"
9+
}
10+
},
11+
"hostRequirements": {
12+
"cpus": 4,
13+
"memory": "8gb"
14+
},
15+
16+
"features": {
17+
"ghcr.io/devcontainers/features/github-cli:1": {}
18+
},
19+
20+
// Configure tool-specific properties.
21+
"customizations": {
22+
// Configure properties specific to VS Code.
23+
"vscode": {
24+
// Add the IDs of extensions you want installed when the container is created.
25+
"extensions": [
26+
"ms-dotnettools.csharp"
27+
],
28+
"settings": {
29+
// Loading projects on demand is better for larger codebases
30+
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
31+
"omnisharp.enableRoslynAnalyzers": true,
32+
"omnisharp.enableEditorConfigSupport": true,
33+
"omnisharp.enableAsyncCompletion": true,
34+
"omnisharp.testRunSettings": "${containerWorkspaceFolder}/artifacts/obj/vscode/.runsettings"
35+
}
36+
}
37+
},
38+
39+
// Add the locally installed dotnet to the path to ensure that it is activated
40+
// This allows developers to just use 'dotnet build' on the command-line, and the local dotnet version will be used.
41+
"remoteEnv": {
42+
"PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}",
43+
"DOTNET_MULTILEVEL_LOOKUP": "0"
44+
},
45+
46+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
47+
"remoteUser": "vscode"
48+
}

.devcontainer/libraries/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// For format details, see https://aka.ms/devcontainer.json.
22
{
3-
"name": "C# (.NET)",
3+
"name": "Libraries/Runtime development (prebuilt)",
44
"build": {
5-
"dockerfile": "Dockerfile",
5+
"dockerfile": "../Dockerfile",
66
"args": {
77
// Update 'VARIANT' to pick a .NET Core version: 6.0, 7.0
88
"VARIANT": "6.0-jammy"

.devcontainer/scripts/onCreateCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ case "$opt" in
1919
./build.sh mono+libs -os browser -c Release
2020

2121
# install dotnet-serve for running wasm samples
22-
./dotnet.sh tool install dotnet-serve --tool-path ./.dotnet-tools-global
22+
./dotnet.sh tool install dotnet-serve --version 1.10.172 --tool-path ./.dotnet-tools-global
2323
;;
2424
esac
2525

.devcontainer/wasm/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// For format details, see https://aka.ms/devcontainer.json.
22
{
3-
"name": "C# (.NET)",
3+
"name": "WASM development (prebuilt)",
44
"build": {
55
"dockerfile": "Dockerfile",
66
"args": {

0 commit comments

Comments
 (0)