diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..556404d4 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile + +# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal +ARG VARIANT="6.0-bullseye-slim" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 18, 16, 14 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..3b9eee9f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet +{ + "name": "C# (.NET)", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0 + // Append -bullseye or -focal to pin to an OS version. + "VARIANT": "6.0-bullseye", + // Options + "NODE_VERSION": "none" + } + }, + // 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", + "EditorConfig.EditorConfig", + "k--kato.docomment" + ], + "settings": { + "omnisharp.enableMsBuildLoadProjectsOnDemand": true, + "omnisharp.enableRoslynAnalyzers": true, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableImportCompletion": true, + } + } + }, + // Use 'postCreateCommand' to run commands after the container is created. + "onCreateCommand": "bash -i ${containerWorkspaceFolder}/.devcontainer/scripts/container-creation.sh", + // Add the locally installed dotnet to the path to ensure that it is activated + // This is needed so that things like the C# extension can resolve the correct SDK version + "remoteEnv": { + "PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}", + "DOTNET_MULTILEVEL_LOOKUP": "0", + "TARGET": "net7.0", + "DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER": "true" + }, + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.devcontainer/scripts/container-creation.sh b/.devcontainer/scripts/container-creation.sh new file mode 100644 index 00000000..a183fef6 --- /dev/null +++ b/.devcontainer/scripts/container-creation.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +# Install SDK and tool dependencies before container starts +# Also run the full restore on the repo so that go-to definition +# and other language features will be available in C# files +./restore.sh + +# The container creation script is executed in a new Bash instance +# so we exit at the end to avoid the creation process lingering. +exit \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2a0a37ea..652d3beb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ *.suo *.user .vs/ -.vscode/ # Build results artifacts/ diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..46e40816 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,44 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Restore projects", + "type": "shell", + "command": "./restore.sh", + "windows": { + "command": ".\\restore.cmd" + }, + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Build entire repository", + "type": "shell", + "command": "./build.sh", + "windows": { + "command": ".\\build.cmd" + }, + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Run all test projects", + "type": "shell", + "command": "./test.sh", + "windows": { + "command": ".\\test.cmd" + }, + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + ] +} \ No newline at end of file