From fa25640ac2358948045a15ba1639c7ed3d6aeed5 Mon Sep 17 00:00:00 2001 From: Shreyas Jejurkar Date: Mon, 1 Nov 2021 23:52:19 +0530 Subject: [PATCH] feat (Codespaces) - Added Commonly used tasks to `tasks.json` for VSCode users. (#37873) * feat (codespaces) - Add EditorConfig as pre-installed extension. * feat (codespaces/vscode) - Add commonly performed tasks to tasks.json * Addressed PR feedback. 1. Added C# XML documentation comments extension to suggested extension. 2. Added some more Omnisharp options to devcontainer based on our omnisharp.json file 3. Renamed tasks to Run all test projects. * Removed extra space * Formatted the Json file using inbuilt vs code formatter! * indent issues * Update build instruction * Keep 8 tabs as previosuly! --- .devcontainer/devcontainer.json | 13 +++--- .vscode/tasks.json | 80 +++++++++++++++++++++++++++++++++ docs/BuildFromSource.md | 4 ++ 3 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 535af4deacc5..712f0464a7c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,20 +16,20 @@ "NODE_VERSION": "lts/*" } }, - // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "ms-dotnettools.csharp" + "ms-dotnettools.csharp", + "EditorConfig.EditorConfig", + "k--kato.docomment" ], - "settings": { // Loading projects on demand is better for larger codebases - "omnisharp.enableMsBuildLoadProjectsOnDemand": true + "omnisharp.enableMsBuildLoadProjectsOnDemand": true, + "omnisharp.enableRoslynAnalyzers": true, + "omnisharp.enableEditorConfigSupport": 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": { @@ -37,7 +37,6 @@ "DOTNET_MULTILEVEL_LOOKUP": "0", "TARGET": "net7.0" }, - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000000..b0b50c905ac4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,80 @@ +{ + "version": "2.0.0", + + "inputs": [ + { + "type": "pickString", + "default": "Debug", + "options": ["Debug","Release"], + "id": "configurationType", + "description": "Select configuration type", + } + ], + "tasks": [ + { + "label": "Restore projects", + "type": "shell", + "command": "./restore.sh", + "windows": { + "command": ".\\restore.cmd" + }, + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Build entire repository (Debug/Release)", + "type": "shell", + "command": "./eng/build.sh -Configuration ${input:configurationType}", + "windows": { + "command": ".\\eng\\build.cmd -Configuration ${input:configurationType}" + }, + "group": "build", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Run all test projects", + "type": "shell", + "command": "./eng/build.sh -test", + "windows": { + "command": ".\\eng\\build.cmd -test" + }, + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Pack assets", + "type": "shell", + "command": "./eng/build.sh --pack", + "windows": { + "command": ".\\eng\\build.cmd -pack" + }, + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Clean artifacts", + "type": "shell", + "command": "./clean.sh", + "windows": { + "command": ".\\clean.cmd" + }, + "group": "none", + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] +} diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index e32909629cda..a293312c3353 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -157,6 +157,8 @@ The following extensions are recommended when developing in the ASP.NET Core rep - [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) +- [C# XML Documentation Comments](https://marketplace.visualstudio.com/items?itemName=k--kato.docomment) + #### WiX (Optional) If you plan on working with the Windows installers defined in [src/Installers/Windows](../src/Installers/Windows), you will need to install the WiX toolkit from . @@ -284,6 +286,8 @@ code . > in `~/.vscode-server/server-env-setup`. > See for details. +In Visual Studio Code, press `CTRL + SHIFT + P` (`CMD + SHIFT + P` on mac) to open command palette, then search and select for `Run Tasks` option. In task list, there are couple of most used tasks are already defined, in that you can select `Build entire repository` option from it to build the repository. Once you select that option, on next window you need to select configuration type from `Debug` OR `Release`. For development purpose one can go with `Debug` option and for actual testing one can choose `Release` mode as binaries will be optimized in this mode. + ### Building on command-line When developing in VS Code, you'll need to use the `build.cmd` or `build.sh` scripts in order to build the project. You can learn more about the command line options available, check out [the section below](#using-dotnet-on-command-line-in-this-repo).