From ae8b2c2e36a20b5d116c4af45eea41d081755a76 Mon Sep 17 00:00:00 2001 From: Shreyas Jejurkar Date: Tue, 6 Apr 2021 05:26:05 +0530 Subject: [PATCH] Added VSCode debugging (for MvcSandbox) & code analysis support (#29486) * Added VSCode debugging support for MvcSandbox * Added ignored vscode folders * 1. Convered some more projects. 2. Added env variable for TargetFramework and used it in launch.json file rather than hardcoding TFW. * Addressed PR feedback. 1. Removed extensions.json 2. Updated BuildFromSource.md for Vscode instructions. 3. Added launch settings for BasicTestApp. * Addressed PR feedback! --- .gitignore | 1 - .vscode/extensions.json | 7 -- .vscode/launch.json | 2 +- docs/BuildFromSource.md | 36 +++++++---- omnisharp.json | 27 ++++++++ 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 | 56 ++++++++++++++++ src/Components/.vscode/tasks.json | 47 ++++++++++++++ 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 | 22 +++++++ src/Mvc/.vscode/tasks.json | 19 ++++++ src/Mvc/omnisharp.json | 18 ++++++ src/Mvc/startvscode.cmd | 3 + startvscode.cmd | 32 +++++++++ 21 files changed, 470 insertions(+), 21 deletions(-) delete mode 100644 .vscode/extensions.json create mode 100644 omnisharp.json 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 create mode 100644 src/Mvc/.vscode/launch.json create mode 100644 src/Mvc/.vscode/tasks.json create mode 100644 src/Mvc/omnisharp.json create mode 100644 src/Mvc/startvscode.cmd create mode 100644 startvscode.cmd diff --git a/.gitignore b/.gitignore index b3970293c1a3..b354350d1b65 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ obj/ .packages/ .tools/ .vs/ -.vscode/ node_modules/ BenchmarkDotNet.Artifacts/ .gradle/ 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 f967d60789e3..d3a7a66be28d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,4 +14,4 @@ "processId": "${command:pickProcess}" } ] -} +} \ No newline at end of file diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index b103be6e64e1..5b6ff4fcf8b6 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 + +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) + +- [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,11 @@ 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 main - > 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 main +> 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 +205,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 +228,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. @@ -302,11 +314,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 @@ -325,7 +337,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: @@ -341,7 +353,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/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/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..39daed7ea684 --- /dev/null +++ b/src/Components/.vscode/launch.json @@ -0,0 +1,56 @@ +{ + "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" + }, + }, + { + "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 new file mode 100644 index 000000000000..5b694e57babe --- /dev/null +++ b/src/Components/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + "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 + } + }, + { + "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/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 new file mode 100644 index 000000000000..594c4cec9fa2 --- /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/${env:TARGET}/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/tasks.json b/src/Mvc/.vscode/tasks.json new file mode 100644 index 000000000000..2bdf8238d217 --- /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 + } + }, + ] +} 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..55dbc5ca8c1a --- /dev/null +++ b/startvscode.cmd @@ -0,0 +1,32 @@ +@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% + +:: Sets TFW for Visual Studio Code usage +SET TARGET=net6.0 + +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