Add helper scripts to open in VS Code with proper SDK (#4523)
authorJuan Hoyos <19413848+hoyosjs@users.noreply.github.com>
Fri, 23 Feb 2024 21:06:10 +0000 (13:06 -0800)
committerGitHub <noreply@github.com>
Fri, 23 Feb 2024 21:06:10 +0000 (13:06 -0800)
start-vs.cmd
start-vscode.cmd [new file with mode: 0644]

index fd74f732fde5934f34874ad16f44caff3a448172..da6fafa477563aabc0c7c5127658128060355c0e 100644 (file)
@@ -6,15 +6,14 @@ set "SLN_OR_PROJ=%~dp0diagnostics.sln"
 
 set "DOTNET_ROOT=%SDK_LOC%"
 set "DOTNET_ROOT(x86)=%SDK_LOC%\x86"
-set DOTNET_MULTILEVEL_LOOKUP=0
 set "DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=%DOTNET_ROOT%"
 
 set PATH=%DOTNET_ROOT%;%PATH%
 
 :: Restore before doing this
 
-if not exist "%DOTNET_ROOT%\dotnet.exe" (
-    echo [ERROR] SDK has not yet been installed.
+IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
+    echo [ERROR] .NET Core has not yet been installed. Run `%~dp0dotnet.cmd` to install tools
     exit /b 1
 )
 
diff --git a/start-vscode.cmd b/start-vscode.cmd
new file mode 100644 (file)
index 0000000..8747d82
--- /dev/null
@@ -0,0 +1,27 @@
+@echo off
+setlocal enabledelayedexpansion
+
+set "SDK_LOC=%~dp0.dotnet"
+
+set "DOTNET_ROOT=%SDK_LOC%"
+set "DOTNET_ROOT(x86)=%SDK_LOC%\x86"
+set "DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=%DOTNET_ROOT%"
+
+set "PATH=%DOTNET_ROOT%;%PATH%"
+
+:: Restore before doing this
+
+SET folder=%~1
+
+IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
+    echo [ERROR] .NET Core has not yet been installed. Run `%~dp0dotnet.cmd` to install tools
+    exit /b 1
+)
+
+IF "%folder%"=="" (
+    code .
+) else (
+    code "%folder%"
+)
+
+exit /b 1