From 6cd89cc197a594cad0453b64a7cfe215350a10d6 Mon Sep 17 00:00:00 2001 From: shreyas jejurkar Date: Thu, 21 Jan 2021 15:43:28 +0530 Subject: [PATCH 1/5] Added VSCode debugging support for MvcSandbox --- .vscode/launch.json | 25 +++++++++++++++---------- omnisharp.json | 27 +++++++++++++++++++++++++++ src/Mvc/omnisharp.json | 18 ++++++++++++++++++ src/Mvc/startvscode.cmd | 3 +++ startvscode.cmd | 29 +++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 omnisharp.json create mode 100644 src/Mvc/omnisharp.json create mode 100644 src/Mvc/startvscode.cmd create mode 100644 startvscode.cmd diff --git a/.vscode/launch.json b/.vscode/launch.json index f967d60789e3..7ef86f229dbe 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,17 +1,22 @@ { "version": "0.2.0", "configurations": [ - { - "type": "PowerShell", - "request": "launch", - "name": "ps: Interactive Session", - "cwd": "${workspaceRoot}" + { + "name": "MvcSandbox", + "type": "coreclr", + "preLaunchTask": "MvcSandbox-build", + "request": "launch", + "program": "${workspaceFolder}/artifacts/bin/MvcSandbox/Debug/net6.0/MvcSandbox.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" } + }, ] } diff --git a/omnisharp.json b/omnisharp.json new file mode 100644 index 000000000000..4c69db8efdd2 --- /dev/null +++ b/omnisharp.json @@ -0,0 +1,27 @@ +{ + "RoslynExtensionsOptions": { + "enableAnalyzersSupport": true + }, + "FormattingOptions": { + "enableEditorConfigSupport": true + }, + "RenameOptions": { + "RenameInComments": true, + "RenameOverloads": true, + "RenameInStrings": true + }, + "msbuild": { + "MSBuildSDKsPath": ".\\.dotnet", + "EnablePackageAutoRestore": true, + "loadProjectsOnDemand": true + }, + "fileOptions": { + "systemExcludeSearchPatterns": [ + "**/node_modules/**/*", + "**/bin/**/*", + "**/obj/**/*", + "**/node_modules/**/*" + ], + "excludeSearchPatterns": [] + } +} diff --git a/src/Mvc/omnisharp.json b/src/Mvc/omnisharp.json new file mode 100644 index 000000000000..0f5627344398 --- /dev/null +++ b/src/Mvc/omnisharp.json @@ -0,0 +1,18 @@ +{ + "RoslynExtensionsOptions": { + "enableAnalyzersSupport": true + }, + "FormattingOptions": { + "enableEditorConfigSupport": true + }, + "RenameOptions": { + "RenameInComments": true, + "RenameOverloads": true, + "RenameInStrings": true + }, + "msbuild": { + "MSBuildSDKsPath": "..\\..\\.dotnet", + "EnablePackageAutoRestore": true, + "loadProjectsOnDemand": true + } +} diff --git a/src/Mvc/startvscode.cmd b/src/Mvc/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Mvc/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/startvscode.cmd b/startvscode.cmd new file mode 100644 index 000000000000..fdc1aa7ef1b2 --- /dev/null +++ b/startvscode.cmd @@ -0,0 +1,29 @@ +@ECHO OFF +SETLOCAL + +:: This command launches a Visual Studio code with environment variables required to use a local version of the .NET Core SDK. + +:: This tells .NET Core to use the same dotnet.exe that build scripts use +SET DOTNET_ROOT=%~dp0.dotnet +SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86 + +:: This tells .NET Core not to go looking for .NET Core in other places +SET DOTNET_MULTILEVEL_LOOKUP=0 + +:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use +SET PATH=%DOTNET_ROOT%;%PATH% + +SET folder=%~1 + +IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" ( + echo .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools + exit /b 1 +) + +IF "%folder%"=="" ( + code . +) else ( + code "%folder%" +) + +exit /b 1 \ No newline at end of file From 90aecf3a3e96916134c0ecedd73630c79b538316 Mon Sep 17 00:00:00 2001 From: shreyas jejurkar Date: Thu, 21 Jan 2021 16:26:17 +0530 Subject: [PATCH 2/5] Added ignored vscode folders --- .gitignore | 1 - .vscode/tasks.json | 15 +++++++++++++++ src/Mvc/.vscode/extensions.json | 7 +++++++ src/Mvc/.vscode/launch.json | 22 ++++++++++++++++++++++ src/Mvc/.vscode/settings.json | 9 +++++++++ src/Mvc/.vscode/tasks.json | 19 +++++++++++++++++++ 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .vscode/tasks.json create mode 100644 src/Mvc/.vscode/extensions.json create mode 100644 src/Mvc/.vscode/launch.json create mode 100644 src/Mvc/.vscode/settings.json create mode 100644 src/Mvc/.vscode/tasks.json diff --git a/.gitignore b/.gitignore index 6f30c0338d65..70638f42ac98 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ obj/ .packages/ .tools/ .vs/ -.vscode/ node_modules/ BenchmarkDotNet.Artifacts/ .gradle/ diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000000..65507b726756 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "MvcSandbox-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/src/Mvc/.vscode/extensions.json b/src/Mvc/.vscode/extensions.json new file mode 100644 index 000000000000..dc0788743602 --- /dev/null +++ b/src/Mvc/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "ms-dotnettools.csharp", + "ms-vscode.PowerShell", + "EditorConfig.EditorConfig" + ] +} diff --git a/src/Mvc/.vscode/launch.json b/src/Mvc/.vscode/launch.json new file mode 100644 index 000000000000..5d8d58653f18 --- /dev/null +++ b/src/Mvc/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "MvcSandbox", + "type": "coreclr", + "preLaunchTask": "MvcSandbox-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/MvcSandbox/Debug/net6.0/MvcSandbox.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + ] +} diff --git a/src/Mvc/.vscode/settings.json b/src/Mvc/.vscode/settings.json new file mode 100644 index 000000000000..3a67def99f21 --- /dev/null +++ b/src/Mvc/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "files.trimTrailingWhitespace": true, + "files.associations": { + "*.*proj": "xml", + "*.props": "xml", + "*.targets": "xml", + "*.tasks": "xml" + } +} diff --git a/src/Mvc/.vscode/tasks.json b/src/Mvc/.vscode/tasks.json new file mode 100644 index 000000000000..8c02a8923b41 --- /dev/null +++ b/src/Mvc/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "MvcSandbox-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/MvcSandbox/MvcSandbox.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + } +] +} \ No newline at end of file From c7a5c9e68f2a43b669242aad4028729cdce1ab98 Mon Sep 17 00:00:00 2001 From: shreyas jejurkar Date: Sun, 31 Jan 2021 16:37:36 +0530 Subject: [PATCH 3/5] 1. Convered some more projects. 2. Added env variable for TargetFramework and used it in launch.json file rather than hardcoding TFW. --- src/Antiforgery/startvscode.cmd | 3 + src/Azure/.vscode/launch.json | 22 +++++++ src/Azure/.vscode/tasks.json | 19 ++++++ src/Azure/startvscode.cmd | 3 + src/Caching/startvscode.cmd | 3 + src/Components/.vscode/launch.json | 39 +++++++++++ src/Components/.vscode/tasks.json | 33 ++++++++++ src/Components/startvscode.cmd | 3 + src/DataProtection/.vscode/launch.json | 90 ++++++++++++++++++++++++++ src/DataProtection/.vscode/tasks.json | 75 +++++++++++++++++++++ src/DataProtection/startvscode.cmd | 3 + src/Mvc/.vscode/launch.json | 32 ++++----- src/Mvc/.vscode/tasks.json | 30 ++++----- startvscode.cmd | 3 + 14 files changed, 327 insertions(+), 31 deletions(-) create mode 100644 src/Antiforgery/startvscode.cmd create mode 100644 src/Azure/.vscode/launch.json create mode 100644 src/Azure/.vscode/tasks.json create mode 100644 src/Azure/startvscode.cmd create mode 100644 src/Caching/startvscode.cmd create mode 100644 src/Components/.vscode/launch.json create mode 100644 src/Components/.vscode/tasks.json create mode 100644 src/Components/startvscode.cmd create mode 100644 src/DataProtection/.vscode/launch.json create mode 100644 src/DataProtection/.vscode/tasks.json create mode 100644 src/DataProtection/startvscode.cmd diff --git a/src/Antiforgery/startvscode.cmd b/src/Antiforgery/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Antiforgery/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/Azure/.vscode/launch.json b/src/Azure/.vscode/launch.json new file mode 100644 index 000000000000..96ed1519b1df --- /dev/null +++ b/src/Azure/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "AzureAppServicesHostingStartupSample", + "type": "coreclr", + "preLaunchTask": "AzureAppServicesHostingStartupSample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/AzureAppServicesHostingStartupSample/Debug/${env:TARGET}/AzureAppServicesHostingStartupSample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + ] +} diff --git a/src/Azure/.vscode/tasks.json b/src/Azure/.vscode/tasks.json new file mode 100644 index 000000000000..818d85782663 --- /dev/null +++ b/src/Azure/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "AzureAppServicesHostingStartupSample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/AzureAppServicesHostingStartupSample/AzureAppServicesHostingStartupSample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + } +] +} diff --git a/src/Azure/startvscode.cmd b/src/Azure/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Azure/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/Caching/startvscode.cmd b/src/Caching/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Caching/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/Components/.vscode/launch.json b/src/Components/.vscode/launch.json new file mode 100644 index 000000000000..dca2a2fca0b4 --- /dev/null +++ b/src/Components/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "BlazorServerApp", + "type": "coreclr", + "preLaunchTask": "BlazorServerApp-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/BlazorServerApp/Debug/${env:TARGET}/BlazorServerApp.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + { + "name": "IgnitorSample", + "type": "coreclr", + "preLaunchTask": "IgnitorSample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/IgnitorSample/Debug/${env:TARGET}/IgnitorSample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + } + ] +} diff --git a/src/Components/.vscode/tasks.json b/src/Components/.vscode/tasks.json new file mode 100644 index 000000000000..0d8fb1fc3fe8 --- /dev/null +++ b/src/Components/.vscode/tasks.json @@ -0,0 +1,33 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "BlazorServerApp-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Samples/BlazorServerApp/BlazorServerApp.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "IgnitorSample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Samples/IgnitorSample/IgnitorSample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/src/Components/startvscode.cmd b/src/Components/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Components/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/DataProtection/.vscode/launch.json b/src/DataProtection/.vscode/launch.json new file mode 100644 index 000000000000..c52970d5eb47 --- /dev/null +++ b/src/DataProtection/.vscode/launch.json @@ -0,0 +1,90 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "CustomEncryptorSample", + "type": "coreclr", + "preLaunchTask": "CustomEncryptorSample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/CustomEncryptorSample/Debug/${env:TARGET}/CustomEncryptorSample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + { + "name": "EntityFrameworkCoreSample", + "type": "coreclr", + "preLaunchTask": "EntityFrameworkCoreSample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/EntityFrameworkCoreSample/Debug/${env:TARGET}/EntityFrameworkCoreSample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + { + "name": "KeyManagementSample", + "type": "coreclr", + "preLaunchTask": "KeyManagementSample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/KeyManagementSample/Debug/${env:TARGET}/KeyManagementSample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + { + "name": "NonDISample", + "type": "coreclr", + "preLaunchTask": "NonDISample-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/NonDISample/Debug/${env:TARGET}/NonDISample.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + }, + { + "name": "Redis", + "type": "coreclr", + "preLaunchTask": "Redis-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/Redis/Debug/${env:TARGET}/Redis.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + } + ] +} diff --git a/src/DataProtection/.vscode/tasks.json b/src/DataProtection/.vscode/tasks.json new file mode 100644 index 000000000000..02fc6d83fa6c --- /dev/null +++ b/src/DataProtection/.vscode/tasks.json @@ -0,0 +1,75 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "CustomEncryptorSample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/CustomEncryptorSample/CustomEncryptorSample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "EntityFrameworkCoreSample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "KeyManagementSample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/KeyManagementSample/KeyManagementSample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "NonDISample-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/NonDISample/NonDISample.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Redis-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/Redis/Redis.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/src/DataProtection/startvscode.cmd b/src/DataProtection/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/DataProtection/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/Mvc/.vscode/launch.json b/src/Mvc/.vscode/launch.json index 5d8d58653f18..594c4cec9fa2 100644 --- a/src/Mvc/.vscode/launch.json +++ b/src/Mvc/.vscode/launch.json @@ -1,22 +1,22 @@ { "version": "0.2.0", "configurations": [ - { - "name": "MvcSandbox", - "type": "coreclr", - "preLaunchTask": "MvcSandbox-build", - "request": "launch", - "program": "${workspaceFolder}/../../artifacts/bin/MvcSandbox/Debug/net6.0/MvcSandbox.dll", - "args": [], - "cwd": "${workspaceFolder}", - "stopAtEntry": false, - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + { + "name": "MvcSandbox", + "type": "coreclr", + "preLaunchTask": "MvcSandbox-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/MvcSandbox/Debug/${env:TARGET}/MvcSandbox.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - }, ] } diff --git a/src/Mvc/.vscode/tasks.json b/src/Mvc/.vscode/tasks.json index 8c02a8923b41..2bdf8238d217 100644 --- a/src/Mvc/.vscode/tasks.json +++ b/src/Mvc/.vscode/tasks.json @@ -2,18 +2,18 @@ "version": "2.0.0", "tasks": [ { - "label": "MvcSandbox-build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/samples/MvcSandbox/MvcSandbox.csproj" - ], - "problemMatcher": "$msCompile", - "group": { - "kind": "build", - "isDefault": true - } - } -] -} \ No newline at end of file + "label": "MvcSandbox-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/samples/MvcSandbox/MvcSandbox.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + }, + ] +} diff --git a/startvscode.cmd b/startvscode.cmd index fdc1aa7ef1b2..55dbc5ca8c1a 100644 --- a/startvscode.cmd +++ b/startvscode.cmd @@ -13,6 +13,9 @@ SET DOTNET_MULTILEVEL_LOOKUP=0 :: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use SET PATH=%DOTNET_ROOT%;%PATH% +:: Sets TFW for Visual Studio Code usage +SET TARGET=net6.0 + SET folder=%~1 IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" ( From d6719fbdc061aea7870401cddda511999dadb868 Mon Sep 17 00:00:00 2001 From: shreyas jejurkar Date: Sat, 27 Feb 2021 13:15:59 +0530 Subject: [PATCH 4/5] Addressed PR feedback. 1. Removed extensions.json 2. Updated BuildFromSource.md for Vscode instructions. 3. Added launch settings for BasicTestApp. --- .vscode/extensions.json | 7 ------ .vscode/launch.json | 2 +- docs/BuildFromSource.md | 34 +++++++++++++++++++----------- src/Components/.vscode/launch.json | 17 +++++++++++++++ src/Components/.vscode/tasks.json | 14 ++++++++++++ src/Mvc/.vscode/extensions.json | 7 ------ 6 files changed, 54 insertions(+), 27 deletions(-) delete mode 100644 .vscode/extensions.json delete mode 100644 src/Mvc/.vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index dc0788743602..000000000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "ms-dotnettools.csharp", - "ms-vscode.PowerShell", - "EditorConfig.EditorConfig" - ] -} diff --git a/.vscode/launch.json b/.vscode/launch.json index 7ef86f229dbe..c9420d741b1f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "coreclr", "preLaunchTask": "MvcSandbox-build", "request": "launch", - "program": "${workspaceFolder}/artifacts/bin/MvcSandbox/Debug/net6.0/MvcSandbox.dll", + "program": "${workspaceFolder}/artifacts/bin/MvcSandbox/Debug/${env:TARGET}/MvcSandbox.dll", "args": [], "cwd": "${workspaceFolder}", "stopAtEntry": false, diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index 3a18f282727b..15a9e177242e 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -53,7 +53,7 @@ Visual Studio 2019 (16.8) is required to build the repo locally. If you don't ha > You can do so by running the `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` command > in PowerShell. For more information on execution policies, you can read the [execution policy docs](https://docs.microsoft.com/powershell/module/microsoft.powershell.security/set-executionpolicy). -The [global.json](/global.json) file specifies the minimum requirements needed to build using `msbuild`. The [eng/scripts/vs.json](/eng/scripts/vs.json) file provides a description of the components needed to build within VS. If you plan on developing in Visual Studio, you will need to have these components installed. +The [global.json](/global.json) file specifies the minimum requirements needed to build using `msbuild`. The [eng/scripts/vs.json](/eng/scripts/vs.json) file provides a description of the components needed to build within VS. If you plan on developing in Visual Studio, you will need to have these components installed. > :bulb: The `InstallVisualStudio.ps1` script mentioned above reads from the `vs.json` file to determine what components to install. @@ -95,6 +95,14 @@ The build should find any JDK 11 or newer installation on the machine as long as This repo contains a Selenium-based tests require a version of Chrome to be installed. Download and install it from . +#### Visual Studio Code Extension + +Following extension are recommanded for Visual Studio Code in order to work with ASP.NET Core repository. + +- [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) + +- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) + #### 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 . @@ -155,9 +163,9 @@ Studio because those projects are not listed in AspNetCore.sln. This will download the required tools and restore all projects inside the repository. At that point, you should be able to open the .sln file or one of the project specific .slnf files to work on the projects you care about. - > :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. On the master - > branch, we regularly update the versions of .NET Core SDK required to build the repo. - > You will need to restart Visual Studio every time we update the .NET Core SDK. +> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. On the master +> branch, we regularly update the versions of .NET Core SDK required to build the repo. +> You will need to restart Visual Studio every time we update the .NET Core SDK. > :bulb: Rerunning the above command or, perhaps, the quicker `.\build.cmd -noBuildNative -noBuildManaged` may be > necessary after switching branches, especially if the `$(DefaultNetCoreTargetFramework)` value changes. @@ -195,6 +203,8 @@ These principles guide how we create and manage .slnf files: Before opening the project in Visual Studio Code, you will need to make sure that you have built the project. You can find more info on this in the "Building on command-line" section below. +To open specific folder inside Visual studio code, you have to open it with `startvscode.cmd` file. Ths will setup neccessary environment variables and will open given directory in Visual Studio Code. + Using Visual Studio Code with this repo requires setting environment variables on command line first. Use these command to launch VS Code with the right settings. @@ -216,7 +226,7 @@ code . ``` > :bulb: Note that if you are using the "Remote-WSL" extension in VSCode, the environment is not supplied -> to the process in WSL. You can workaround this by explicitly setting the environment variables +> to the process in WSL. You can workaround this by explicitly setting the environment variables > in `~/.vscode-server/server-env-setup`. > See for details. @@ -310,11 +320,11 @@ Additional properties can be added as an argument in the form `/property:$name=$ Common properties include: -Property | Description --------------------------|------------------------------------------------------------------------------------------------------------- -Configuration | `Debug` or `Release`. Default = `Debug`. -TargetArchitecture | The CPU architecture to build for (x64, x86, arm, arm64). -TargetOsName | The base runtime identifier to build for (win, linux, osx, linux-musl). +| Property | Description | +| ------------------ | ----------------------------------------------------------------------- | +| Configuration | `Debug` or `Release`. Default = `Debug`. | +| TargetArchitecture | The CPU architecture to build for (x64, x86, arm, arm64). | +| TargetOsName | The base runtime identifier to build for (win, linux, osx, linux-musl). | ### Resx files @@ -333,7 +343,7 @@ Building installers does not run as part of `build.cmd` run without parameters, .\build.cmd -buildInstallers ``` -*Note*: Additional build steps listed above aren't necessary on Linux or macOS. +_Note_: Additional build steps listed above aren't necessary on Linux or macOS. - Run the installers produced in `artifacts/installers/{Debug, Release}/` for your platform. - Add a NuGet.Config to your project directory with the following content: @@ -349,7 +359,7 @@ Building installers does not run as part of `build.cmd` run without parameters, ``` - *NOTE: This NuGet.Config should be with your application unless you want nightly packages to potentially start being restored for other apps on the machine.* + _NOTE: This NuGet.Config should be with your application unless you want nightly packages to potentially start being restored for other apps on the machine._ - Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build. diff --git a/src/Components/.vscode/launch.json b/src/Components/.vscode/launch.json index dca2a2fca0b4..39daed7ea684 100644 --- a/src/Components/.vscode/launch.json +++ b/src/Components/.vscode/launch.json @@ -34,6 +34,23 @@ "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, + }, + { + "name": "BasicTestApp", + "type": "coreclr", + "preLaunchTask": "BasicTestApp-build", + "request": "launch", + "program": "${workspaceFolder}/../../artifacts/bin/BasicTestApp/Debug/${env:TARGET}/BasicTestApp.dll", + "args": [], + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, } ] } diff --git a/src/Components/.vscode/tasks.json b/src/Components/.vscode/tasks.json index 0d8fb1fc3fe8..5b694e57babe 100644 --- a/src/Components/.vscode/tasks.json +++ b/src/Components/.vscode/tasks.json @@ -28,6 +28,20 @@ "kind": "build", "isDefault": true } + }, + { + "label": "BasicTestApp-build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/test/testassets/BasicTestApp/BasicTestApp.csproj" + ], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } } ] } diff --git a/src/Mvc/.vscode/extensions.json b/src/Mvc/.vscode/extensions.json deleted file mode 100644 index dc0788743602..000000000000 --- a/src/Mvc/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "ms-dotnettools.csharp", - "ms-vscode.PowerShell", - "EditorConfig.EditorConfig" - ] -} From 55596d362e6ff7cd370cb502786cfff1ac9bedfa Mon Sep 17 00:00:00 2001 From: shreyas jejurkar Date: Wed, 10 Mar 2021 19:46:33 +0530 Subject: [PATCH 5/5] Addressed PR feedback! --- .vscode/launch.json | 27 +++++++++++---------------- .vscode/tasks.json | 15 --------------- docs/BuildFromSource.md | 2 +- src/Mvc/.vscode/settings.json | 9 --------- 4 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 .vscode/tasks.json delete mode 100644 src/Mvc/.vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json index c9420d741b1f..d3a7a66be28d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,22 +1,17 @@ { "version": "0.2.0", "configurations": [ - { - "name": "MvcSandbox", - "type": "coreclr", - "preLaunchTask": "MvcSandbox-build", - "request": "launch", - "program": "${workspaceFolder}/artifacts/bin/MvcSandbox/Debug/${env:TARGET}/MvcSandbox.dll", - "args": [], - "cwd": "${workspaceFolder}", - "stopAtEntry": false, - "serverReadyAction": { - "action": "openExternally", - "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + { + "type": "PowerShell", + "request": "launch", + "name": "ps: Interactive Session", + "cwd": "${workspaceRoot}" }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" } - }, ] -} +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 65507b726756..000000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "MvcSandbox-build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/src/Mvc/samples/MvcSandbox/MvcSandbox.csproj" - ], - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index 15a9e177242e..dba6a12655cc 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -97,7 +97,7 @@ This repo contains a Selenium-based tests require a version of Chrome to be inst #### Visual Studio Code Extension -Following extension are recommanded for Visual Studio Code in order to work with ASP.NET Core repository. +The following extensions are recommended when developing in the ASP.NET Core repository with Visual Studio Code. - [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) diff --git a/src/Mvc/.vscode/settings.json b/src/Mvc/.vscode/settings.json deleted file mode 100644 index 3a67def99f21..000000000000 --- a/src/Mvc/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "files.trimTrailingWhitespace": true, - "files.associations": { - "*.*proj": "xml", - "*.props": "xml", - "*.targets": "xml", - "*.tasks": "xml" - } -}