Skip to content

Commit

Permalink
Improve DevContainer configuration for Codespaces (dotnet#91465)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akoeplinger committed Sep 1, 2023
1 parent f6b6415 commit 2aea244
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
File renamed without changes.
48 changes: 48 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Standard configuration",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 6.0, 7.0
"VARIANT": "6.0-jammy"
}
},
"hostRequirements": {
"cpus": 4,
"memory": "8gb"
},

"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
],
"settings": {
// Loading projects on demand is better for larger codebases
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableAsyncCompletion": true,
"omnisharp.testRunSettings": "${containerWorkspaceFolder}/artifacts/obj/vscode/.runsettings"
}
}
},

// Add the locally installed dotnet to the path to ensure that it is activated
// This allows developers to just use 'dotnet build' on the command-line, and the local dotnet version will be used.
"remoteEnv": {
"PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}",
"DOTNET_MULTILEVEL_LOOKUP": "0"
},

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
4 changes: 2 additions & 2 deletions .devcontainer/libraries/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "C# (.NET)",
"name": "Libraries/Runtime development (prebuilt)",
"build": {
"dockerfile": "Dockerfile",
"dockerfile": "../Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 6.0, 7.0
"VARIANT": "6.0-jammy"
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/scripts/onCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ case "$opt" in
./build.sh mono+libs -os browser -c Release

# install dotnet-serve for running wasm samples
./dotnet.sh tool install dotnet-serve --tool-path ./.dotnet-tools-global
./dotnet.sh tool install dotnet-serve --version 1.10.172 --tool-path ./.dotnet-tools-global
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/wasm/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "C# (.NET)",
"name": "WASM development (prebuilt)",
"build": {
"dockerfile": "Dockerfile",
"args": {
Expand Down

0 comments on commit 2aea244

Please sign in to comment.